Due: Oct. 19 Name: luid: Date




Дата канвертавання26.04.2016
Памер12.22 Kb.
COSC 4302: Introduction to Operating Systems

Homework 3

Posted: Sept. 30, Due: Oct. 19


Name: ______________________
LUID: ______________________
Date: ______________________


  1. Textbook P. 188 -> question 1. Provide the detailed steps involved in …

(15 points)

(Note: there is one mistake in this question. You should “Use the explanation of the input instruction in Section 5.2…”, instead of “Section 5.1”)




  1. Textbook P. 189 -> question 11. Suppose the read/write head is at track 97…

(15 points)


  1. Textbook P. 230 -> question 7. Suppose an OS was designed…

(15 points)

(Note: there are two mistakes in this question. For “Blocked for reusable resource: Waiting for a reusable resource…”. For “Blocked for consumable resource: Waiting for a consumable resource…”)


Programming question

(55 points)


A parent process and a child process use kill() and signal to communicate. Please use fork() to create the child process from the parent. After that, the parent process can then send the following signals to the child process using kill():


  1. SIGHUP: hang-up (death) on controlling terminal (process) (Default action: abnormal termination)

  2. SIGINT: interactive attention signal (usually Ctrl-C) (Default action: abnormal termination)

  3. SIGQUIT: interactive termination: core dump (Default action: implementation dependent)

The parent process can sleep() some time (for example, 5 seconds) after sending each signal.


The child process:


  • After receiving SIGHUP: output “I have received SIGHUP”;

  • After receiving SIGINT: output “I have received SIGINT”;

  • After receiving SIGQUIT: output “I have received SIGQUIT”, and terminate.

Here is the pseudocode for this program:


A list of functions defining the actions associated with signals
main()
1. Create the child process;
2. if (child process)

{

Use signal() or sigaction() to specify the action associated with the signal;



Infinite loop;

}
3. if (parent process)

{
Send SIGHUP to the child process;

Sleep some time;
Send SIGINT to the child process;

Sleep some time;
Send SIGQUIT to the child process;

Sleep some time;
}
For more examples, please refer to Chapter 8 of the following textbook:
Unix System Programming, K.A. Robbins and S. Robbins, Prentice Hall, ISBN: 0-13-042411-0, 2003
How to Turn In:
Both hardcopy and softcopy are required.

  1. Hardcopy: Please turn in a hardcopy of solutions on the due date;

Softcopy: Please email your solutions to all the questions to osfall2010.lamar@gmail.com in one email.

  1. Please include a. your name; b. COSC4302 – Homework1; in the subject of the

email.

3. For programming questions, please do NOT use MS WORD. Please send .c files.



Class Policy:
Some programming questions are used in previous semesters. Please do NOT borrow solutions from those students who have taken this class before. We keep a database of all previous solutions.
Programming solutions will be checked carefully for plagiarism. Students who are caught copying directly will receive 0 for this assignment.





База данных защищена авторским правом ©shkola.of.by 2016
звярнуцца да адміністрацыі

    Галоўная старонка