Sample Quiz 1

  1. Operating Systems are typically defined as fulfilling two roles. Describe each role and give an example.
  2. Multiprocessing and multiprogamming are two concepts that are sometimes confused by people who haven't taken CS537. Describe the difference.
  3. Describe cooperative multitasking and discuss its advantages and disadvantages.
  4. Consider the following output from running the utility top on one of the royal instructional machines. What properties can you infer about mysteryJob1 and mysteryJob2? Do you think that mysteryJob2 is cpu-bound or not? Explain your reasons.
    Tasks:  92 total,   6 running,  86 sleeping,   0 stopped,   0 zombie
    Cpu(s): 99.7% us,  0.2% sy,  0.0% ni,  0.0% id,  0.0% wa,  0.2% hi,0.0% si
    Mem:   1033764k total,  1017892k used,    15872k free,     1480k buffers
    Swap:  2096440k total,      216k used,  2096224k free,   142292k cached
    
      PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND            
    10268 dusseau   25   0  2140  232  180 R   50  0.0   2:27.67 mysteryJob1                  
    10267 dusseau   25   0  1684  228  180 R   50  0.0   2:27.59 mysteryJob1                  
    10276 dusseau   25   0  384m 381m  180 R   50 37.8   1:05.49 mysteryJob2                  
    10282 dusseau   25   0  383m 381m  180 R   50 37.8   1:04.39 mysteryJob2                  
    10246 dusseau   15   0  3148 1580  940 S    0  0.2   0:00.10 tcsh               
    10294 dusseau   16   0  2636  956  764 R    0  0.1   0:00.40 top                
    
  5. Consider the following short C program, stored in the file argv.c.
    #include < stdio.h >
    
    int main(int argc, char *argv[])
    {
    
      if (argc >= 2) {
        printf("Argc: %d, argv[0]: %s, argv[1]: %s\n", argc, argv[0], argv[1]);
      }
    }
    
    
    If it is compiled as gcc argv.c -o argv and run as argv hello there, what will the output be?