Você está na página 1de 4

1. Operating Systems are said to be interrupt driven.

Question 1. What is an interrupt?


Answer, Interrupt is a signal that gets the attention of the CPU and is usually generated
when I/O is required. For example, hardware interrupts are generated when a key is
pressed or when the mouse is moved. Software interrupts are generated by a program
requiring disks input or output.
Question 2. How does software trigger an interrupt?
Answer, software interrupts are generated by a program requiring disk input or output
Question 3. With the aid of a neat labelled diagram, explain the role of an interrupt in a
context switch.

Answer, when an interrupt is triggered. Either by software or hardware, control is


transferred the OS and the OS determined which action to be taken. In context switching
wise, the interrupt causes the CPU to switch from one process to another either to save
the state of a process and load the state of a saved process.

2. A process is a program in execution.


Question 1. With the aid of a neat diagram show the time relations between each
of the 5 states a process can be in.
Question 2. Explain the function of the Process Control Block (PCB)
Answer, a process control block is used for information associated with each
processes (also known as Task control block). This may include process state,
whether running, waiting, etc. Program counter, this are location of instructions
next to execute.
A process in an operating system is represented by a data structure known as a
process control block (PCB) or process descriptor. The PCB contains important
information about the specific process including the current state of the process
i.e., whether it is ready, running, waiting, or whatever. Unique identification of the
process in order to track "which is which" information. A pointer to parent
process. Similarly, a pointer to child process (if it exists). The priority of process (a
part of CPU scheduling information). Pointers to locate memory of processes. A
register save area. The processor it is running on. The PCB is a certain store that
allows the operating systems to locate key information about a process. Thus, the
PCB is the data structure that defines a process to the operating systems.

Question 3. List any 3 pieces of information stored in the PCB.


Answer,
1. Process State, process state may be new, ready, running, waiting or
terminated.

2. Program Number
3. Program Counter, program counter indicates the address of the next
instruction to be executed for this process.
4. CPU Registers, CPU registers include general purpose register, stack pointer,
index register and accumulators etc.
5. Memory limit
6. List of open files
7. Accounting Information, accounting information
Includes the amount of CPU and real time used, time limits, job or process numbers,
account numbers etc.

3. Processes need to be created by a parent process.

Question 1. With the aid of a neat labelled diagram show the sequence involved in
process creation using the Unix fork () system call.
Answer,

Parent process creates children processes that is generally identified and


managed via a process identifier or pid. Programs are loaded into the child
process.

Question 2. After a fork () system call, how are the separate codes for parent and child
processes identified?

4. In multiprocessing systems, running processes often need to communicate (IPC).

Question 1. What are the two main models of IPC?


Answer, the two main models of IPC are:
1. Shared Memory Model, Shared memory model. An area of memory shared among
process that wish to communicate. The communication is under the control of the
users process not the operating system. Major issues to provide the mechanism that
will allow the user process to synchronize their actions when they access shared
memory
2. Message passing model

Message passing model is a Mechanism provided by OS for processes to communicate and synchronize
their action. Particularly useful for distributed environments.

(a) With the aid of a neat labelled diagram, explain how each model allows IPC.

Você também pode gostar