CS252 Midterm review - CS252 Systems Programming Midterm Exam Preparation Please write by hand the answers and turn them in the day of the exam The

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CS252 Systems Programming Midterm Exam Preparation Please write by hand the answers and turn them in the day of the exam. The solutions will be posted the day before the exam. I suggest you try to solve the questions before looking at the solution. Part 1. True False Questions Answer True/False (T/F) (1 point each) T ELF stands for Executable Link Format. T A process has a stack for every thread it contains. T A process ID may be reused T Race conditons are more likely to happen in multiprocessor machines. F In POSIX threads, the thread calling fork will create a child process that is a copy of the parent inclluding all the threads in the process. Part 2. Short questions. 2. Write down the fields of an i-node Mode - Read, Write, Execute bits for Owner/Group/All Owners - Userid, Groupid Time Stamps - Creation time, Access Time, Modification Time Size - Size of file in bytes Reference Count - Incremented with each hard link (added to a directory), removed when 0 3. Explain what is deadlock and what is starvation and give an example of each. Deadlock is when one or more threads is waiting on a resource that will never be available and will block forever. Starvation is when a thread may have to wait a long time before a resource becomes available. An example of deadlock is locking two mutex locks in two separate threads in the opposite order. If thread T1 locks M1, a context switch occurs, and thread T2 locks M2, then thread T2 cannot lock M1 and will block forever and T1 similarly cannot lock M2. An example of thread starvation is a read/write lock where the number of readers is always greater than 0. 4. What are the advantages and disadvantages of using threads vs. using processes?
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Threads share the same global variables and therefore are more prone to race conditions and data corruption, but they are also faster and easier to communicate between since you don't need to rely on interprocess communication like pipes or files. Threads are less robust than processes, since one thread crashing will crash the program while independent processes won't. Creating new threads and context switching between them is faster than processes. 5. Mention three important files that are stored in /etc in UNIX.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/30/2012 for the course CS 252 taught by Professor Gustavorodriguez during the Fall '11 term at Purdue University-West Lafayette.

Page1 / 8

CS252 Midterm review - CS252 Systems Programming Midterm Exam Preparation Please write by hand the answers and turn them in the day of the exam The

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online