Summer 2014
Homework 2
1. [2] What are asynchronous, deferred, and disabled cancellation in pthreads? What makes them different?
2. What is the role of the contentionscope for pthreads? How does it affect the execution of pthreads?
3. Assume you have a system that does not provide a usleep(unsigned long usec) call to suspend the execution of the thread for a given amount of time, say in µsecs.
How would you implement this function using condition variables? (Describe your implementation in form of a C/C++ code snippet similar to the textbook.)
4. (Research Assignment) The execve system call (and variations of it) transforms the calling process into a new process by loading the given executable into memory.
(a) What happens to the file descriptors of open files?
(b) How can this behavior be controlled?
5. [3] Ten processes share a critical section implemented by using a semaphore x. Nine of these processes use the code P(x); <critical section>; V(x). However, one process erroneously uses the code V(x); <critical section>; P(x). What is the maximum number of processes that can be in the critical section at the same time?
6. [3] A customer gives the following instructions to a bank manager: Do not credit any funds to my account if the balance in my account exceeds n, and hold any debits until the balance in the account is large enough to permit the debit. Design a class in Java
(called SafeAccount, to be initialized with a given value for n) with two methods, credit and debit, that implements this type of account.
References
[1] A. Silberschatz, P. Galvin, and G. Gagne, Applied Operating Systems Concepts, John
Wiley & Sons, Inc., New York, NY, 2000.
[2] Deitel, Deitel, and Choffnes, Operating Systems, Pearson / Prentice Hall, 2004.
[3] D. M. Dhamdhere, Operating Systems, a Concept-Based Approach, McGraw Hill, 2009.
1
References: [1] A. Silberschatz, P. Galvin, and G. Gagne, Applied Operating Systems Concepts, John Wiley & Sons, Inc., New York, NY, 2000. [2] Deitel, Deitel, and Choffnes, Operating Systems, Pearson / Prentice Hall, 2004. [3] D. M. Dhamdhere, Operating Systems, a Concept-Based Approach, McGraw Hill, 2009. 1
You May Also Find These Documents Helpful
-
The term _________________ is used to denote when instructions from only one thread can be issued at a time.…
- 378 Words
- 2 Pages
Satisfactory Essays -
5. This chapter describes the concepts behind how a CPU reads the contents from RAM. Which of the following is true about the process of read data. As described in the chapter?…
- 1315 Words
- 6 Pages
Good Essays -
12. Today’s bankers owe more to their customers than they actually have in reserve; therefore they keep enough assets on hand to meet reasonable withdrawals.…
- 505 Words
- 3 Pages
Satisfactory Essays -
Bank may require a minimum amount of money in the account. Bank will charge a fee if money is taken out early.…
- 1035 Words
- 4 Pages
Satisfactory Essays -
3)Suppose a bank advertises a “free” checking account but requires that a $2000 minimum average daily balance be maintained in the…
- 1010 Words
- 3 Pages
Good Essays -
possible the system clock could easily lose the correct time. The system clock is also used for scheduling purposes. For example, the time…
- 948 Words
- 6 Pages
Good Essays -
Operating systems are the link between the user and the applications and the hardware. They are responsible for deciding how the user commands will be interpreted and how the operating system itself will carry the process. There are several different types of operating and each carries out processing in their own way. Windows, UNIX/Linux and Mac are some of the most popular and widely used operating systems.…
- 1355 Words
- 6 Pages
Better Essays -
References: Stallings, W. (2012). Operating systems: Internals and design principles (7th ed.). Boston, MA: Prentice Hall.…
- 392 Words
- 2 Pages
Good Essays -
Simon, Herbert A. And Munakata, Toshinori. "AI Lessons: (Artificial Intelligence: IBM 's Deep Blue Chess Computer)," Communications of the Association for Computing Machinery (1997): August, Vol. 40, No. 8, pp. 23-26.…
- 1702 Words
- 7 Pages
Powerful Essays -
A(n) _________________________ is an interest bearing checking account and gives the bank the right to insist on prior notice before customer withdrawals can be honored.…
- 5387 Words
- 22 Pages
Good Essays -
6. The Receiver, which runs in the Data Link Layer of the destination machine, waits for a frame to arrive and remembers the sequence number of the next frame expected…
- 430 Words
- 2 Pages
Satisfactory Essays -
Now, first major problem mentioned in Section 9.4.1 will be discussed. How do we allocate the fixed amount of free memory among the various processes?…
- 842 Words
- 3 Pages
Good Essays -
Any thread can be at any step in this process at any time, and they can step on each other when a shared resource is involved. The state of x can be changed by another thread during the time between x is being read and when it is written back.…
- 6908 Words
- 28 Pages
Powerful Essays -
Blocked: A process that cannot execute until a specified event such as an IO completion…
- 470 Words
- 2 Pages
Satisfactory Essays -
*The hold and wait or resource holding conditions may be removed by requiring processes to request all the resources they will need before starting up (or before embarking upon a particular set of operations). This advance knowledge is frequently difficult to satisfy and, in any case, is an inefficient use of resources. Another way is to require processes to request resources only when it has none. Thus, first they must release all their currently held resources before requesting all the resources they will need from scratch. This too is often impractical. It is so because resources may be…
- 779 Words
- 4 Pages
Good Essays