Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please explain clearly 1. Q1. In your system there is only one printer and there is a queue for the files to wait to be
please explain clearly
1. Q1. In your system there is only one printer and there is a queue for the files to wait to be printed. The size of the queue is limited to N. There are processes sending files to be printed to the queue. If there is no space left in the queue, sending process waits. The printer reads the first file in the queue, prints it and goes for the next one. If there is no file in the queue, the printer waits for a file. By using semaphores, write the functions to control the actions of senders and the printer. 2. Two semaphores S1 and S2 are both initialized to 1 in a system. Two threads T1 and T2 are executing following codes. Explain the possible problem in these codes? (how deadlock may occur?) T1 \begin{tabular}{ll} wait(S1); & wait(S2); \\ wait(S2) & wait(S1) \\ ..... &....... \\ signal(S2) & signal(S1); \\ signal(S1) & signal(S2); \end{tabular}Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started