Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

Views: 252

Replies to This Discussion

Today is last date anyone given helping idea.........

Please Discuss here about this assignment.Thanks

Our main purpose here discussion not just Solution

We are here with you hands in hands to facilitate your learning and do not appreciate the idea of copying or replicating solutions.

CS703 - Advanced Operating Systems Assignment No. 1 Solution Fall 2016 Due Date: Nov 21, 2016

CS703 – Advanced Operating Systems







Assignment 1





Instructions to Solve Assignments


The purpose of the assignments is to give you hands on practice. It is expected that students will solve the assignments themselves. Following rules will apply during the evaluation of assignment.


  • Cheating from any source will result in zero marks in the assignment.
    • Any student found cheating in any two of the assignments submitted will be awarded "F" grade in the course.
    • No assignment after due date will be accepted.



























Exercise Specification


The exercise here expands on the fan structure of simplefan.c through the development of a simple batch processing facility, called runsim. The runsim program takes exactly one command-line argument specifying the maximum number of simultaneous executions. Follow the outline below for implementing runsim. Write a test program called testsim to test the facility. Suggested library functions appear in parentheses.


  1. Write a program called runsim that takes one command-line argument.
  2. Check for the appropriate command-line argument and output a usage message if the command line is incorrect.
  3. Initialize pr_limit from the command line. The pr_limit variable specifies the maximum number of children allowed to execute at a time.
  4. Initialize the pr_count variable to 0. The pr_count variable holds the number of active children.
  5. Execute the following main loop until end-of-file is reached on standard input.
    1. If pr_count is pr_limit, wait for a child to finish (wait) and decrement pr_count.
    2. Read a line from standard input (fgets) of up to MAX_CANON characters and execute a program corresponding to that command line by forking a child (forkmakeargvexecvp).
    3. Increment pr_count to track the number of active children.
    4. Check to see if any of the children have finished (waitpid with the WNOHANGoption). Decrement pr_count for each completed child.
    5. After encountering an end-of-file on standard input, wait for all the remaining children to finish (wait) and then exit.


Write a test program called testsim that takes two command-line arguments: the sleep time and the repeat factor. The repeat factor is the number of times testsim iterates a loop. In the loop, testsim sleeps for the specified sleep time and then outputs a message with its process ID to standard error. Use runsim to run multiple copies of the testsim program.


Create a test file called that contains commands to run. For example, the file might contain the following lines.


        testsim 5 10
        testsim 8 10
        testsim 4 10
        testsim 13 6
        testsim 1 12


Run the program by entering a command such as the following.


        runsim 2 <



Provided Files


Following files are provided along with this assignment file.


makeargv.c: The makeargv function creates an argument array pointed to by argvp from the string s, using the delimiters specified by delimiters. If successful, makeargv returns the number of tokens. If unsuccessful, makeargv returns –1 and sets errno. You are required to use makeargv  function in runsim program and compile makeargv.c along with runsim.c.


simplefan.c: A program that creates a fan of n processes where n is passed as a command-line argument.



Submission Guidelines


  • You are required to submit the source files runsim.c and testsim.c.
  • You will also submit a one page readme.txt file describing how to compile and run your program correctly. If your program does not compile or run as per your own instructions, marks will be deducted.
  • You are encouraged to discuss the problem with your colleagues. However, you are not allowed to look at their code or help them in debugging.



Marks Distribution


runsim.c        40 marks

testsim.c.     05 marks

readme.txt    05 marks



Reference Book


Unix Systems Programming: Communication, Concurrency, and Threads by Kay A. Robbins and Steven Robbins



If you have any query regarding the assignment, contact at the course’s email address.


Looking For Something? Search Below

Latest Activity

VIP Member Badge & Others

How to Get This Badge at Your Profile DP


Management: Admins ::: Moderators

Other Awards Badges List Moderators Group

© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service