Solutions - Computer Science

advertisement
CS Division – EECS Department
University of Central Florida
CGS 3763 – Operating System Concepts
Spring 2013 – dcm
Homework 2 (100 points)
Due Wednesday, Wednesday February 13, 5 PM
A homework should be written in Word or Latex and should be Emailed to the TA
Edward Aymerich; Email:edward.aymerich@knights.ucf.edu
Subject of the Email: First.Last student name - HW2
The following problems are from the textbook, 8th Edition.
Problem 2.1
Originally, Apple’s iOS for mobile devices did not support concurrent processing. Discuss
three major complications when concurrent processing adds to an operating system.
1. A time sharing mechanism (for example: preemption) must be used to
prevent process from monopolizing the CPU.
2. Protection of resources: to avoid that one process can damage the
execution of another process (for example: memory protection).
3. Prevent deadlocks: so that process don't wait forever for another
process to release resources.
Problem 2.2
When a process uses the fork() system call to create a new process which of the following
states is shared between the parent and the child process: (a) stack; (b) Heap; (c) Shared
memory segments.
Only (c) Shared memory segments.
Problem 2.3
Describe step-by-step the actions taken by a kernel during a context switch.
1. The kernel saves the context of the current process into its PCB.
2. The short term scheduler chooses the next process to run.
3. The kernel loads the saved context of the selected process from its
PCB.
4. The kernel returns control to the selected process.
Problem 2.4
Discuss the undesirable consequences of not enforcing either the at-most-once or exactlyonce semantics of a Remote Procedure Call (RPC).
The undesirable consequence of not enforcing those policies is that the
server can't guarantee that one RPC call is doesn't execute multiple times.
Problem 2.5
List the information stored in a Process Control Block (PCB). When is the PCB created?
What information in the PCB is modified during the processing of an interrupt occurring
while the process is running?
The PCB has the following information:
 Process state.
 Program counter (PC).
 CPU registers.
 CPU scheduling information.
 Memory management information.
 Accounting information.
 I/O status information.
The PCB is created when the associated process is created.
The information modified in the PCB during an interrupt is the process state,
program counter and CPU registers.
Problem 2.6
Define the terms: synchronous and asynchronous communication. What are the advantages
and disadvantages of each? Consider both system and user level communication.
Synchronous communication: this is when the sender must wait (the sender
is blocked) until the information is received at the other end. An example of a
synchronous communication is a telephone call.
Advantages: it is easier to coordinate the communication process.
Disadvantages: Both ends must be available at the same time to establish a
channel of communication.
Asynchronous communication: this happen when the sender doesn't wait (or
doesn't block) after sending information. An example of an asynchronous
communication is the e-mail system.
Advantages: the sender doesn't block, so it can keep up doing useful work
instead of waiting.
Disadvantages: There is not a guarantee that the information is received
immediately at the other end.
Problem 2.7
Discuss the functions of the system calls for process control






Load
Execute
Create, terminate a process
Block a process, abort
Get process attributes/set process attributes
Allocate/deallocate memory for a process
Load: loads a binary file into memory.
Execute: after load, starts the execution of the binary file.
Create, terminate a process: After execute, the parent process can create
more children or wait for termination.
Block a process, abort: The process stops execution until an external event
resumes it. For abort, it produces an abnormal termination of the process.
Get process attrib/set process attributes: obtains or modifies information
from the PCB of the process.
Allocate/deallocate memory for a process: request or releases memory (RAM)
dynamically for a process.
Download