Top-Rated Free Essay
Preview

CPSC 313 Introduction To Computer SystemsSummer

Satisfactory Essays
299 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
CPSC 313 Introduction To Computer SystemsSummer
CPSC 313 Introduction to Computer Systems

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

  • Good Essays

    Nt1210 Chapter 1 Review

    • 1315 Words
    • 6 Pages

    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
  • Satisfactory Essays

    What Is Stock Anyway

    • 1035 Words
    • 4 Pages

    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
  • Satisfactory Essays

    Comma Splices

    • 505 Words
    • 3 Pages

    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
  • Good Essays

    Ans1A

    • 1010 Words
    • 3 Pages

    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
  • Satisfactory Essays

    Explain the difference of “reg to mem”, “mem to reg” and “mem to mem” ISAs.…

    • 348 Words
    • 2 Pages
    Satisfactory Essays
  • 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
  • Better Essays

    Linux vs Windows vs Mac

    • 1355 Words
    • 6 Pages

    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
  • Good Essays

    References: Stallings, W. (2012). Operating systems: Internals and design principles (7th ed.). Boston, MA: Prentice Hall.…

    • 392 Words
    • 2 Pages
    Good Essays
  • Powerful Essays

    Computer Engineering

    • 1702 Words
    • 7 Pages

    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
  • Satisfactory 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
  • Good Essays

    lru algorithm report

    • 842 Words
    • 3 Pages

    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
  • Good 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
  • Good Essays

    Deadlock

    • 779 Words
    • 4 Pages

    *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
  • Powerful Essays

    Liham Pangaplikasyon

    • 6908 Words
    • 28 Pages

    Race Condition occurs when two threads access a shared variable at the same time. The first thread reads the variable, and the second thread reads the same value from the variable. Then the first thread and second thread perform their operations on the value, and they race to see which thread can write the value last to the shared variable. The value of the thread that writes its value last is preserved, because the thread is writing over the value that the previous thread wrote.…

    • 6908 Words
    • 28 Pages
    Powerful Essays
  • Satisfactory Essays

    Process Control Block

    • 470 Words
    • 2 Pages

    3. Thread is a basic unit of CPU utilization; it comprises a thread ID, a program counter, a register set, and a stack. It shares with other threads belonging to the same process its code section, data section, and other operating-system resources, such as open files and signals.…

    • 470 Words
    • 2 Pages
    Satisfactory Essays