Software development final exam: Part 2

This is part 2 of my software development final exam. If you haven't read that introductory blog post, please go read it now.

Computer Architecture and Operating Systems

  1. Name and describe the four states in MESI cache coherence.
  2. Which of the following two functions is faster, and why? Assume that the C code is translated into machine code in the obvious manner, without optimization.
    void zeroarray1(double * A)
    {
            int i, j;
    
            for (i = 0; i < 1024; i++)
                    for (j = 0; j < 1024; j++)
                            A[i * 1024 + j] = 0.0;
    }
    
    void zeroarray2(double * A)
    {
            int i, j;
    
            for (j = 0; j < 1024; j++)
                    for (i = 0; i < 1024; i++)
                            A[i * 1024 + j] = 0.0;
    }
    
  3. Explain the difference between a mutex and a read-write lock.
  4. Why does the pthread_cond_wait function (wait on a condition variable) take a locked mutex as a parameter?
  5. What is a TLB? When and why is it most often (completely) flushed?

If you would like me to grade your answers, please send an email to cperciva-exam-part2@tarsnap.com with your answers to the above questions along with the following two:

Please note that the questions are intended to be answered under "exam conditions", i.e., without discussion with anyone else, and without consulting Google, Wikipedia, or other sources. I'm running this as an experiment to see how much basic computer science software developers know, and in what areas, so please don't "cheat".

Part 3 of the exam — mathematics — is now available.

Posted at 2012-10-09 09:00 | Permanent link | Comments
blog comments powered by Disqus

Recent posts

Monthly Archives

Yearly Archives


RSS