Test 1 - Processes

CS 438, Operating Systems Analysis


  1. What is the difference between a process and a thread?


    A thread contains much less state than does a process, which makes threads cheaper and easier to manipulate than processes. Threads execute within a process, using the process state - such as open files and the address space - to suppliment their own state. Because all threads within a process share the process state, they may use the shared state to communicate among themselves.


  2. What is mutual exclusion? What is a critical region?


    Mutual exclusion is a form of resource access that ensures that a resource shared among several executing entities (processes or threads) is accessed by only one entity at a time. A critical region is a finite section of an entity's code within which the entity is guaranteed to have mutually exclusive access to a shared resource.


  3. Construct a critical region using semaphores. Don't forget to show the semaphore's initial value.


    global semaphore mutex = 1
    
    /* other code */
    
    down(mutex) /* enter critical region */
    
    /* access shared resource */
    
    up(mutex) /* leave critical region */
    
    


  4. You are designing an operating system that runs processes without preemption. Do you need to include a scheduler in your system? Explain.


    Yes you do. Even if a process only releases the CPU when it terminates, the operating system still needs to figure out which process gets the CPU next, and that is what a scheduler does.



This page last modified on 6 March 2000.