Computer Science 284

Introduction to Operating Systems

Question Pool for Exam 1

CONSTANTS IN THESE QUESTIONS MAY CHANGE WHEN THE QUESTION IS INCLUDED ON THE EXAM

What was the original purpose/goal in the design of operating systems?

What is today main purpose/goal in the design of operating systems?

Explain why the primary purpose of having an O.S. changed from the 1960 to the 1990s.

Spooling and buffering are both techniques for improving I/O efficiency - but they are different techniques.
     Explain how spooling works WITHOUT mentioning/using buffering

     Explain how buffering works WITHOUT mentioning/using spooling

Buffering is used to overcome what problem?

Spooling is used to overcome what problem?

Early system designers wanted to increase CPU efficience by increasing the number of programs in memory from 1 to some small n.  Explain the reasoning behind that goal; ie. why would having more programs in RAM increase total CPU efficiency?

True False  The purpose of buffering is to compensate for lack of real memory.

True False  The purpose of spooling is to compensate for lack of real memory.

True False  A forked process may share data space with its parent.

True False  A forked process may share code space with its parent.

True False  A forked process may share a Run-Time Stack with its parent

Who are the 2 individuals generally credited with the invention of C/Unix?

What is dual mode operation?

Why does a machine need dual mode operation?

What is a context switch?

Why are context switches considered undesirable (to be minimized) by OS designers?

Draw a Unix 'Process State' graph.

Give an example of something that a process might do to initiate a voluntary context switch.  Relate this answer to the Process State graph.

Give an example of something that would cause a process to experience an involuntary context switch.  Relate this answer to the Process State graph.

In C, if you were to write
    int main()
    {
         int x;
         scanf("%d",&x) ;
    }
Why 'in the design of the C language is it necessary to write &x instead of just scanf("%d",x)?  ie. you don't have to explicitly pass the address in other languages like Fortran or Pascal or Cobol.

What is changed by putting '&' at the end of a command line to unix?  Explain this in terms of the shell's behavior.

From the keyboard, how do you signify end of file in Unix?

How do you change the name of a file in Unix?

What is logically wrong with the following block of code?

     if ( fork() == 0 )
     {    printf("Howdy partner");
           args = n;
           execl("/u3/adekock/mypgm", "mypgm", "abc", "xyz", 0);
           printf("Now I'm back");
     }
    .
    .
     ......

When a process resumes execution after returning from a fork(), how can it tell if it is the original process or the new one?

GIVEN: a command line entry like -
    a.out XX YY ZZ
complete the def. of main() and the printf to print the YY argument
    int main(                                            )
    {
       printf("                       ",                               );
    }

What is the difference between a blocking function call and a nonblocking call?

What are the important differences between a unix fork() and thr_create()?

What is the function prototype for thr_create()?

Given
    int X[10];
    some appropriate function MyFun
    thread_t Tid;
Write the call to thr_create, which executes MyFun, which accepts the array X as an argument

What is the required function prototype for the function MyFun()?

Write 1 line of code for MyFun that printf's the 3rd integer in the array passed to it.

True  False  A thread may share data space with its parent.

True  False  A thread may share code space with its parent.

True  False  A thread may share a location counter with its parent.

True False  A thread may share a File Descriptor Table with its parent

When a new thread is created, several options may be selected.  What is the effect of each of the following:
   THR_SUSPENDED
   THR_NEW_LWP
   THR_DETACHED
   THR_BOUND

In traditional unix the kernel schedules _____________________ (what entities)

In Solaris the kernel schedules ________________________ (what entities)

Explain why you would expect to find a different frequency of context switches in a purely batch system compared to an interactive system.

If the instruction to set the privilege bit  is a privileged instruction, how does a process in user mode get privileged operations performed?

What is the difference between a pre-emptive scheduler and a time-sliced one?

  • Which type is used by Unix?
  • Which type is used by the Solaris thread library?

  • What does it mean to say that a library or a module is MT-Safe?

    A kernel level context switch may or may not be  required to switch between user level threads (within the same process). What determines whether the kernel is involved or not when switching between threads?

    How does a thread acquire RAM that is NOT shared with other threads in the task?

    What is the effect of executing

    1. thr_yield()?
    2. thr_suspend(...)?
    3. thr_continue(...)?


    What does it mean to say that "mutex_lock(...) is a blocking call"?

    Why does the man page, for thr_exit(VALUE), say that VALUE should not reference any variable local to the calling thread?

    Assume that you have globally defined
        struct Shared
        { char Name[10];
           int Value;
        } S1, S2;

        thread_t tid;
        void * RtnValue;
        void * FooBar(void * arg);   // For this problem, arg will point to an instance of struct Shared

    Show the correct way to:

    1. Store "THREAD 1" in S1's Name field:
    2. Pass S1 in the following call:
    3. From within the function FooBar, print the Name that was passed inside the struct:
    4. store 2 times the thread id into the Value field of arg:
    5. return the struct via a thr_exit:
    6. Have main retrieve the returned value:  Use the variable RtnValue since you don't know which thread has exit-ed.
    7. Have main print which thread exit-ed and the integer returned:
    What is an atomic operation?

    What is a critical section?

    What is the difference between mutex_lock and mutex_trylock?

    What are the 3 possible dispositions that a process may specify with respect to an interrupt?

    An interrupt will pend unless a process specifies _______________________.

    Show the program parts necessary to cause a process to print a message the 1st time that the keyboard operator presses ^C (and further ^Cs would exit the program).  For the same program, what has to be changed to get the message N times and then exit on the (N+1)th time?

    What function is used from within a process to send an interrupt to a process?

    The word 'mutex' is short for ______________________________________.

    What makes a portion of code within a function the 'critical section'?

    What would you expect to see (what instructions) surrounding the 'critical section' code?

    If a mutex_t M is associated with locking a variable counter, whos responsibility is it to make sure that counter isn't used without 1st locking M?

    Many modern O.S.s use a microkernel design.  What does that mean?  What adjective is applied to 'old' O.S.s?

    What 6 states may a Win2K thread be in?

    In Linux, vs. Unix, how is a thread represented within the O.S.?

    What is the meaning of the address store in a location-counter?