Posts

Showing posts with the label SPOS lab

Implement UNIX system calls like ps, fork, join, exec family, and wait for process management (use shell script/ Java/ C programming).

//A small example to show how to use execvp() function in C. We will have two .C files , EXEC.c and execDemo.c and we will replace the execDemo.c with EXEC.c by calling execvp() function in execDemo.c . //EXEC.c  #include<stdio.h>  #include<unistd.h>  int main()   {        int i;       printf("This  is EXEC.c, called by execvp() ");        printf("\n");       return 0;   }  Now,create an executable file of EXEC.c using command  gcc EXEC.c -o EXEC //execDemo.c #include<stdio.h> #include<stdlib.h>  #include<unistd.h>  int main()  {     //A null terminated array of character      //pointers       char *args[]={"./EXEC",NULL};       execvp(args[0],args);     /*All statements are ignored after execvp() call as this whole process(execDemo.c) is replaced by ...

Implement Pass-II of two pass assembler for pseudo-machine in Java using object oriented features. The output of assignment-1 (intermediate file and symbol table) should be input for this assignment.

 /* Problem Statement: Implement Pass-II of two pass assembler for pseudo-machine in Java using object oriented features. The output of assignment-1 (intermediate file and symbol table) should be input for this assignment. */ import java.io.BufferedReader; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.HashMap; public class Pass2 { public static void main(String[] Args) throws IOException{ BufferedReader b1 = new BufferedReader(new FileReader("intermediate.txt"));      BufferedReader b2 = new BufferedReader(new FileReader("symtab.txt"));      BufferedReader b3 = new BufferedReader(new FileReader("littab.txt"));      FileWriter f1 = new FileWriter("Pass2.txt");      HashMap<Integer, String> symSymbol = new HashMap<Integer, String>();      HashMap<Integer, String> litSymbol = new HashMap<Integer, String>();   ...