Home CS439

CS439: Principles of Computer Systems

Discussion Section 1 Problem Set

Due in Section on Friday, January 16, 2024

The problem set must be completed before section and brought to section. To ensure that your problem set is turned in correctly and that you receive credit for discussion section, you must follow these guidelines exactly.
  1. What is concurrency? List some examples of concurrency appearing in the history of operating systems.

  2. Phase 2 of the history of operating systems brought about interactive timesharing which allowed multiple users to use the same system at the same time.

    • What key hardware feature enabled the development of interactive timesharing?
    • What new OS considerations were required to support multiple users?

  3. What are "privileged instructions"? Name three situations in which privileged instructions are required.

  4. Given the following piece of code:
        main(int argc, char** argv)
        {
            forkThem(5);
        }
    
        void forkThem(int n)
        {
            if(n>0)
            {
            fork();
            forkThem(n-1);
            }
        }
    

    How many processes are created if the above piece of code is run?

  5. Given the following piece of code:
    main(int argc, char**argv)
    {
       int child=fork();
       int c=2;
       
       if(child==0)
       {
          c+=2;
       }
       else
       {
          child=fork();
          c+=4;
          if(child==0)
             c+=2;
       }
    }
    
    How many different copies of the variable c are there? What are their values?

    Defend your answer.