19-Feb-2004

Review Class 1

Discussing Questions on the Quiz
-----------------------------------------------

Batch Processing
Interactive
Multiprogramming: The ability of a computer system to switch execution among several jobs that are in memory at the same time.
Time slicing refers to a rigid maximum time span that processes can execute before preemption
Multiprocessing is the use of 2 or more processors by the OS
Multitasking (a.k.a. Timesharing) is a characteristic that implies multiple users. (More than one instance of same process)
Real time. Often used in a dedicated application, this system reads information from sensors and must respond within a fixed amount of time to ensure correct performance.

Resource
Race Condition:Race conditions occur when two or more processes or threads attempt to manipulate the same data object concurrently such that the final value of the data object is non-deterministic
Deadlock
Rendezvous
Policy Vs Mechanism: Why is the separation of mechanism and policy a desirable property?
Answer:
Informally Policy is "what to do?" and Mechanism is "how to do/implement?".Mechanism and policy must be separate to ensure that systems are easy to modify. No two system installations are the same, so each installation may want to tune the operating system to suit its needs. With mechanism and policy separate, the policy may be changed at will while the mechanism stays unchanged. This arrangement provides a more flexible system.

fork() creates process: difference b/w thread and process: Thread is a basic unit of CPU utilization, and consists of a PC, a register set and a stack space. It shares w/ peer threads its code section, data section, os resources such as open files and signals.

What resources are used when a thread is created? How do they differ from those used when a process is created?
Answer:
Because a thread is smaller than a process, thread creation typically uses fewer resources than process creation. Creating a process requires allocating a process control block (PCB), a rather large data structure. The PCB includes a memory map, list of open files, and environment variables. Allocating and managing the memory map is typically the most time-consuming activity. Creating a thread involves allocating a small data structure to hold a PC, register set, stack, and priority.
Discussed rest of the quentions on the quiz.

- discussed rest of the questions --


Group Activity
---------------------

[01] How does an SJF scheduler behave when jobs all require the same amount of CPU time?
Answer:
FCFS

[02] Process         Arrival Time           Burst Time

            P1                      0.0                        8

            P2                      0.4                        4

            P3                      1.0                        1
a. What is the average turnaround time for these processes with the FCFS scheduling algorithm?
b. What is the average turnaround time for these processes with the SJF scheduling algorithm?

Answer:

a.
10.53
b.
9.53

[03] What advantage is there in having different time-quantum sizes on different levels of a multilevel queueing system?

Answer:
Processes that need more frequent servicing, for instance, interactive processes such as editors, can be in a queue with a small time quantum. Processes with no need for frequent servicing can be in a queue with a larger quantum, requiring fewer context switches to complete the processing, making more efficient use of the computer.

[04] What (if any) relation holds between the following pairs of sets of algorithms?
a. Priority and SJF
b.
MLFQ and FCFS
c. Priority and FCFS
d. RR and SJF

Answer:

a. The shortest job has the highest priority.
b. The lowest level of MLFQ is FCFS.
c. FCFS gives the highest priority to the job having been in existence the longest.
d. None

[05] Consider a system consisting of four resources of the same type that are shared by three processes, each of which needs at most two resources. Can deadlock ever occur?

Answer: Suppose the system is deadlocked. This implies that each process is holding one resource and is waiting for one more. Since there are three processes and four resources, one process must be able to obtain two resources. This process requires no more resources and, therefore it will return its resources when done.