1 Suppose that Lucy and Ethel have gone to work for the Mizzo candy factory. Mizzo produces two types of candy: crunchy frog bites and everlasting escargot suckers. Unlike their last job, Mizzo has automatic flow control on their assembly line. No more than 10 candies are on the conveyer belt at any given time. Crunchy frog bites tend to be more expensive than escargot suckers, so Mizzo has implemented a policy to prevent putting too many frog bites in the same box. No more than 3 frog bites can be on the line at any given time. (Candies are taken off the line in the order that they are produced.) Write pseudocode to simulate this multiple producer and consumer problem. Each candy generator should be written as a separate process. The consumer processes (Lucy & Ethel) should share common code. 2 In class, we discussed an algorithm for mutual exclusion using TestAndSetLock. We indicated that this was not a critical region. Show why the algorithm does not implement a critical region. Remember to use the definition of critical region that I gave in class as opposed to Tanenbaum's. 3 Justify the use of threads in an operating system. Next, consider a multithreaded process where one thread has scheduled an input. If the process forks, there are now two threads waiting for input and the operating system must determine how this should be handled. Can this situation ever occur in a single threaded process? Why or why not? 4 Explain context switches and justify why at least portions of context switch code are always written in assembly. Operating system designers are likely to assign some of their best coders to the task of designing the context switch code. Why is this? 5 An adaptive mutex is a semaphore that makes a decision as to whether or not to busy wait depending upon the state of other processes in a multi-processor system. When a process attempts to wait on a semaphore, the following is done (for simplicity, we consider a mutex between two processes only): wait (Semaphore S) { [url removed, login to view] = [url removed, login to view] - 1; if ([url removed, login to view] < 0) { /* Some other process P holds the semaphore */ P = process in critical region for semaphore S; if (state(P) == running) { while ([url removed, login to view] < 0) /* busy wait */ no-op; } else { add calling process to wait list for S; block calling process; } } } What is the rationale for providing such a semaphore?

## Deliverables

Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.

## Deadline information

deadline is sunday or monday

Kemahiran: Pengaturcaraan C, Kejuruteraan, Java, Linux, MySQL, PHP, Kejuruteraan Perisian, Ujian Perisian, UNIX

Lihat lagi: what types of designers are there, what's an algorithm, what is the definition of algorithm, what is the algorithm, what is functional programming, what is a programming algorithm, what is an algorithm in programming, what is an algorithm, what is algorithm in programming, what is algorithm, what is a class in programming, what is a algorithm in programming, what does algorithm, what an algorithm, use of algorithm in programming, types of algorithm, thread programming, the best php code generator, switch c programming, semaphore programming

Tentang Majikan:
( 5 ulasan ) United States

ID Projek: #2829028

Dianugerahkan kepada:


See private message.

$85 USD dalam 14 hari
(7 Ulasan)

2 pekerja bebas membida secara purata $51 untuk pekerjaan ini


See private message.

$17 USD dalam 14 hari
(26 Ulasan)