Operating Systems - Assignment 3 - Process Description and Control

Ace your homework & exams now with Quizwiz!

1. Describe the significance of a Process's Priority. 2. How does a process's priority affect the selection of the next ready process from the dispatch FIFO?

1. A process is assigned a 'priority' which describes its 'importance' in the running of the system. Some processes are more important and so have a higher priority than other less important processes. On a desktop system, the process running the GUI (windows) runs at a higher priority than an application e.g. Word. This is because the user's experience will be poorer if the GUI seems sluggish or not responsive. 2. The priority affects what processes are dispatched during a context switch. We described the ready queue as FIFO. This is true if all the ready processes have the same priority. However, "ready" Pi has a higher priority than other ready processes, then it will be placed at the head of the FIFO so that the dispatcher selects before the others for execution.

Describe what it means to "Suspend a Process". Why would the system operator choose to suspend a process? What is the benefit of suspending a process?

1. A suspended process is one that has been set into a 'suspended' state and while in the suspended state, will not be scheduled for execution by the dispatcher (i.e. made Ready). 2. Suspension is useful if the system finds itself over-capacity. That is, if there is a shortage of physical memory, I/O capacity, or other limited resource, the system begins thrashing and no progress can be made by any of the executing processes. Under these conditions, suspending a process will free its resources without terminating its execution. These freed resources will be available to the remaining unsuspended processes allowing them to make progress. 3. The benefit of process suspension is that a process can be temporarily halted (i.e. suspended from execution) freeing memory, processor, and other resources (I/O capacity and others) for the remaining executing processes. Because the process is only suspended (and not terminated), a suspended process can later be un-suspended and continue its execution.

1. Describe the meaning of "Context Switch". 2. What two events trigger a context switch? 3. What OS component is responsible for performing a context switch? 4. Describe a context switch's 6 steps as found in the slides.

1. The context switch is the process of halting / blocking the execution of the currently "running" process and the installation of the next 'ready' process for execution (running). 2. A context switch is triggered by either a timer interrupt or by the running process executing a blocking system call. 3. The Dispatcher is activated and performs the steps shown below. 4. The six steps are: a. Save the information needed to restore the process the currently running process. b. Change the running process's state to Ready or to Blocked. c. The dispatcher selects the next process to be scheduled from the READY queue. d. Change the selected process's state to Running. e. Restore the selected process's Processor Context from its Process Control Block. f. The running process resumes execution from where it was last interrupted.

Answers to this question are found in the textbook. 1. Explain the meaning of a process's instruction trace. 2. Explain the instruction trace presented in Figure 3.4 in the book. How many processes are represented in this figure? What is meant by Time-Out and by I/O Request? 3. Explain the role of the dispatcher service in all of this. Explain how the dispatcher represented in Figure 3.4 instructions.

1. The instruction trace is a list (or trace) of the instruction address that a process executes over some given time-range while in the 'Running' state. 2. Figure 3.4 illustrates the execution of three processes interleaved with the dispatcher's execution. The execution of a process divided into slices and every 'ready-to-run' process is given a turn executing. The process's execution can be interrupted for two reasons in this example. Either the process executes a Blocking I/O Request (Blocking SYSCALL) or it executes for the full duration of its time-slice and is preempted by timer interrupt. 3. The dispatcher is the OS mechanism that selects, installs, and allows to execute a "ready to execute" process from the Ready Process Queue. The dispatcher performs the switch from the currently running to the next process to execute. The dispatcher's execution is represented by the gray shaded traces which execute the same instructions each time.

1. What information is maintained in the Process Image? 2. In what two places does a process image reside? 3. What are the five generic steps involved with building a new process image?

1. The process image is the region of memory (disk or main memory) containing the instructions / data / stack of the program being executed. Note that in the model presented in the text, the image also contains the Process Control Block. In this class, the PCB resides in the Kernel for security purposes. 2. The process image resides on the system drive (as a file) and in main memory. The image is initially created on the drive and copied into main memory for execution. The reasons for this will be presented in a later section. 3. The five generic steps are: 1. Allocate space for the new image on the system (swap) drive. Copy text and data segments from the executable file to the new image. 2. Create the Process Control Block and other kernel data structures needed by the OS to maintain the process's execution. 3. Assign a unique process ID (PID) to the new process. 4. Copy the image from the system drive into main memory. 5. Put the new Process in the Ready state and place in the Ready FIFO Queue.

Using Figure 3.6 from the text, describe the process states and conditions that cause a process to transition from one state to another i.e. 1) The transition from New to Ready. 2) Ready to Running 3) Running to Ready 4) Running to Blocked 5) Blocked to Ready 6) Running to Exit. Hint: Refer to the slide containing this figure and the accompanying diagram containing the Ready Queue, etc.

New to Ready: When a new process has been fully installed by the OS i.e. its Process Control Block has been created, its process image has been created, and it is ready to be installed in the ready queue for its turn at execution. Ready to Running: The dispatcher selects a ready process from the Ready Process FIFO. The process's Processor Context is installed on the processor and the process begins executing its current slice. Running to Ready: The process has completed its slice (time-out) and is interrupted by the Timer Interrupt. Is processor context is saved and it is moved to the back of the FIFO waiting for its turn to be re-scheduled. Running to Blocked: The process has executed a blocking system call (e.g. I/O request) and its execution is blocked while it waits for the associated event signaling that the request has completed. Blocked to Ready: The blocked process's request has finished (event) and it is once again eligible for execution. The process is moved from the blocked list to the ready FIFO. Running to Exit: The process has been released by the OS for one of several reasons given in the book and slides. The process control block and system resources allocated to the process are also released.

Does every mode switch (i.e. system call or interrupt) result in a blocked process? That is, is every syscalls blocking? Explain why or why not.

No. The process may switch to kernel mode in response to a system call that involves no I/O or other blocking condition. For example a call to malloc() or free() to allocated or free memory can be executed by the process causing a mode switch. However, these calls only update internal OS tables and so control can be returned to the calling process without the process entering the 'blocked' state.

Describe the purpose of the Process Control Block and describe the three categories of information it maintains.

The Process Control Block (PCB) is a data structure maintained by the OS Kernel. It is used to maintain the information needed to maintain a single process. A PCB is maintained for every process currently hosted on the system. Generically the PCB maintains three categories of information: Process Identification: Information that describes the identity of the process i.e. Process ID, Parent Process ID, the ID of the user (account) that owns the process. The account ID is needed to determine resource access privileges e.g. to determine access rights to files. Process Control: Information used by the kernel to manage the process. Includes the process's scheduling information (e.g. scheduling priority), resources owned by the process (e.g. files, sockets, memory), and accounting information (running time). Processor State: The state of the processor needed to allow the process to be context switched in and out of the running state. That is, the processor state to be restored when the process transitions into the running state.

Describe the four mechanisms that are used to preempt a process's execution.

The four mechanisms are: 1. Device Interrupts: A hardware signal from a system device controller that signals that the controller will soon need servicing. 2. Timer Interrupts: The interrupt generated by the hardware timer that interrupts the currently executing process so that the dispatcher can gain control and perform a context switch. Although the timer interrupt basically a hardware interrupt, its purpose is fundamentally different from the interrupts generated by system controllers. 3. Blocking System Calls (SYSCALL): A request by the process to the OS for some service. Implemented by a software interrupt instruction (INT). 4. Traps: Errors made by the process's execution that are caught by hardware and software. For example, when the process's execution attempt to access memory not allocated to the process. A process that executes a division by zero.

Describe the difference between the monolithic kernel architecture and the process-based kernel (microkernel) architecture. Include a description about how a user process accesses kernel services in each model.

The monolithic kernel architecture implements the kernel as a single (monolithic) block of executable instructions and data that is loaded and executed at system boot. The kernel instructions provide the facilities needed to create and maintain processes, device interrupt handlers, and individual syscall instructions (e.g. read(), open(), malloc(), etc.). Also included in the same kernel are the syscall interrupt handling used to transfer control from a process to code residing in the kernel program. The process-based kernel architecture (also known as a Microkernel architecture) implements its services as 'kernel processes' (see slide Microkernel Architecture). Kernel Processes are processes that have special privileges such as access hardware e.g. device controllers. User processes and kernel services are implemented as separate processes. Processes (user and kernel) are interconnected by a relatively microkernel service layer that implements process management functionality (process creation and scheduling) and provides a fast Inter-Process Communication mechanism that allows user and kernel processes to exchange requests for services. The later allows user processes to make service requests (syscalls) to kernel processes.


Related study sets

Society and Culture: Demographics

View Set

Body Cavities and Organs located within

View Set