You are on page 1of 2

Operating System 2012 Lab Assignment # 2

Activity 1
1. Write down a 3 line explanation of following command of linux ps 2. Write a small piece of code that run and infinite loop printing “Test”. Compile and run it and keep it running while doing step 3 3. Use ps command to locate the id and status of your program you have started executing in step 2 4. Find what is Zombie in linux 5. Adjust the sleep calls for parent and child and use ps to answer these questions What status is being printed when the child terminates before the parent, but the parent does not? What is the parent process id (PPID) of a child process whose parent terminates before the child? To make the parent wait for the child, replace the sleep() by pid = waitpid(pid,&status, 0) in the code. Here status is an integer. For the parent and read about the function by executing man 2 wait.

Activity 2
I hope all of you are aware of merge sort. Lets assume you are given the task to display the mobile company records of their customer’s calls in sorted order. The company CEO is interested in getting the records in following form

Time Last month Last 6 months Last 1 year

Number of Calls to other networks

Number of calls to same network

One f the inefficient solution is to write down the code in one single process to sort the records using merge sort. However, when this process is written down, the output time is huge which irritates the CEO. He has assigned you the task to write an efficient code so that he can get the results in order of few seconds. You can assume that the records are stored in the file in following format CustomerID, Call Date, Calling Network You can further assume that the calling network attribute in the above line can have two possible values only. If it is 0, it means the call was made to the same network. If it is 1, the call was made to the other network. You have to use the merge sort to sort the records by date. Perform first two levels of merge sort in separate processes. When records have been sorted, create another process that can print the records in the format CEO likes (as shown in the table above) Example: Let’s say there are 100,000 records in the file. Merge sort divides the records into half in the first step, so will you do with the records. First 50,000 records will be sorted by process1. Other 50,000 records will be sorted by process 2.

Read about NACHOS Download it from http://www. 6.cs. Specifically you should look for the answers of following questions What if I have to run the halt command – It is built in. 2. 4. . you just need to see what is the command to use for halting nachos What I need to do if I have to write my SelfTest() function? How do I call it. 5.If you make the Compile it and run it using “nachos –K” command Do some RnD of Nachos project and see how you should start work on it. it would be something like the following Display Information Sort Records Aggregate information and display it Sort First half of records Sort Second half of records Activity 3: NACHOS – MOST IMPORTANT ACTVITY 1.washington. 3.