Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Topic is Operating Systems Please answer what you can. Some questions could have multiple correct answers. Choose all correct answers. a point for each correct

Topic is Operating Systems

Please answer what you can.image text in transcribed

Some questions could have multiple correct answers. Choose all correct answers. a point for each correct answer selected. a half-point off for each incorrect answer selected.

QUESTION 1 Threads T1 and T2 execute echo(). Assume unbuffered I/O. Ti & T2 share the same keyboard, processor and user space; getchar() and putchar() are async-safe. // shared globals volatile sig_atomic char_in; volatile sig atomic char_out; // thread T1 void echo() { 1 char_in = getchar(); 2 char_out = char_in; 3 putchar(char_out); } // thread T2 void echo() { 4 char_in = getchar(); 5 char out = char in; 6 putchar (char_out); } The user types 'x' followed by 'y' at the keyboard. Both ti and T2 run to completion with *no* synchronization. Which two statements are true? OA. If the statement order is 145236 then 'xx' would be displayed. OB. If the statement order is 142356 then 'Yy' would be displayed. OC. If the statement order is 124356 then 'xy' would be displayed. OD. If the statement order is 124563 then 'yx' would be displayed. QUESTION 2 Which two statements are true about Strong Readers/Weak Writers synchronization on shared memory? OA. Each writer requires mutual exclusion on shared memory. OB. All readers read before any writers write. OC. The order in which the readers read and the writers write is synchronized. OD. Writers may not get fair access given a large number of readers. QUESTION 3 Select the two true statements concerning mutex operations. OA. If thread A locks a mutex thread B can unlock it. OB. Multiple threads can lock a mutex (similar to a counting semaphore). OC. The ownder of a mutex is the thread that locked it. OD. A thread blocks on a lock operation if the mutex is locked by another thread. QUESTION 4 Select the two true statements concerning semaphore/mutex notation. OA. In Dijkstra's original notation, 'P' is wait and 'V' is signal. OB. A semaphore signal refers to a release operation. OC. A mutex unlock operation could block. OD. In classic semaphore notation 'Up' refers to a lock operation. QUESTION 5 Two processes P1 and P2 are concurrently running and competing for resource R. Both are blocked on semaphore S, thus preventing access to R. Pi has waited longer. Which two statements are true? OA. P1 is currently suffering from starvation. OB. P1 will starve only if Pi is blocked indefinitely. OC. If s is a strong semaphore then P1 will gain access before p2. OD. If s is a weak semaphore then P2 will gain access before Pl

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 2 Lnai 9285

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Joao Gama ,Alipio Jorge ,Carlos Soares

1st Edition

3319235249, 978-3319235240

More Books

Students also viewed these Databases questions