Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Operating Systems (Chapter 4)

Question: List out the difference between Message passing and Shared memory

Message Passing Shared Memory


Data consistency Useful for exchanging smaller Memory might be overridden
amounts of data because no data is read
conflicts need to be avoided
External communication Easier to implement for inter Difficult for separate computers
computer communication to share a memory space
Overhead Requires kernel intervention Faster because only system call
because implemented as is needed to setup shared-
system calls memory region. Then access is
treated as memory-access
Data Duplication Copies of data exists and needs No duplicated data because no
to be duplicated before transfer data is transferred, only access
can begin is given to other process

1. Define the responsibilities of an Operating System with respect to Process Management.


a. Process
- Creation and deletion
- Suspension and resumption
- Synchronization (shared data is handled to minimize

2. Draw the process state diagram depicting the FIVE states that a process can be in
- New: The process is being created
- Running: Instruction are being executed
- Waiting: The process is waiting for some event to occur
- Ready: The process is waiting to be assigned to a CPU
- Terminated: The process has finished its execution

3. Explain the THREE different types of process schedulers


a. Short term scheduler
i. Selects from ready to execute jobs in main memory and allocates the CPU to
them
b. Medium term scheduler
i. to remove partially run programs from memory and reinstate them
later to continue where they left out (swap scheme)

c. Long term scheduler


i. Determines which jobs are brought into main memory (from secondary stage)
for processing

4. What do you mean by process elements ?


a. While a process is in execution, it can be uniquely characterized by process elements,
such as :
i. Identifier = A unique process id
ii. State: Sate= {new, ready, running, waiting, terminated}. If the process is
currently executing, it I in the running state
iii. Priority = Priority level relative to other processes
iv. Program counter = The address of the next instruction in the program to be
executed
v. Memory pointers =
1. Program code
2. Data associated with this process
3. Memory blocks shared with other processes
vi. Context data = Data in the processor’s registers while the process is executing
vii. I/O status information = Includes outstanding I/O requests, I/Odevices (e.g tape
drivers) assigned to the process, a list of files in use by

the process and so on


viii. Accounting Information = May include the amount of processor time and clock
time used, time limits, account numbers, and so on

5. What do you mean by process control block?


a. The process elements are stored in a data structure, called process control block (PCB)
b. When a process is created (we say it is in the new state), the information concerning the
process is maintained in PCB in main memory
c. However, the process itself is not in main memory but in secondary storage
i. The code of the program to be executed is not in main memory
ii. No space has been allocated for the data associated with that program

6. Why PCB is helpful for multiprocessing?


a. When a process is interrupted, the current values of
i. The program counter and
ii. The processor register (context data)
b. Are saved in the process elements of the process control block
c. And the state of the process is changed
d. The OS I now free to put some other process in the running state
i. The program counter and context data for this process are loaded into
processor registers and this process now begins to executes
7. What information does the operating system need to control processes and manage resources
for them?
a. Information about the current status of each process and resource
b. The operating system has to construct and maintain tables of information about each
entity that it is managing
i. Memory table – used to keep track of both main (real) and secondary (virtual)
memory. Some of main memory is reserved for use by the
operating system; the remainder is available to the process
ii. I/O table – used by the operating system to manage the I/O devices
iii. File table – are used to manage the files and accesses to the files
iv. Process table – Each entry contains at least one pointer to a process image
- The Process Image contains data, code, stack and process
control block associated with a process

8. Specify the events for which the new processes are created in a computer
a. System Initialization
i. When an operating system is booted, typically several processes are created
1. Foreground process that interact with users and perform work for them
2. Background processes, which are not associated with particular users,
but instead have some specific function
a. Processes that stay in the background to handle some activity
such as email, Web pages, security (antivirus), printing and so
on are called daemons. Large systems commonly have dozens
of them.
b. Execution of a process creation system call by a running process
i. Often a running process will issue system calls to create one or more new
processes to help it do its job
ii. For example, if a large amount of data is being fetched over a network for
subsequent processing, it may be convenient to create
1. One process to fetch the data and put them in a shared buffer while
2. A second process removes the data items and processes them
c. A user request to create a new process
i. In interactive systems, users can start a program by typing a command or
(double) clicking an icon. Taking either of these actions starts a new process and
runs the selected program in it
d. Initiation of a batch job
i. Processes are created in the batch systems found on large mainframes
ii. Here users can submit batch jobs to the system (possibly remotely)
iii. When the operating system decides that it has the resources to run another job,
it creates a new process and runs the newx job from the input queue in it

You might also like