<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[CS604 Assignment 3 Solution and Discussion]]></title><description><![CDATA[<p dir="auto">Operating Systems (CS604)<br />
Assignment # 03<br />
FALL 2019	<br />
Total marks = 20</p>
<p dir="auto">Deadline Date<br />
22nd Jan 2020</p>
<p dir="auto">Please carefully read the following instructions before attempting assignment.</p>
<p dir="auto">RULES FOR MARKING<br />
It should be clear that your assignment would not get any credit if:<br />
	The assignment is submitted after the due date.<br />
	The submitted assignment file does not open or it is corrupt.<br />
	 The submitted assignment solution is copied from any other student or from the internet.</p>
<p dir="auto">You should consult the recommended books to clarify your concepts as handouts are not sufficient.</p>
<p dir="auto">You are supposed to submit your assignment in .doc or docx format.<br />
Any other formats like scan images, PDF, zip, rar, ppt and bmp etc. will not be accepted.</p>
<p dir="auto">Objective:<br />
•	The objective of this assignment is to provide understanding of:<br />
Semaphore and Resource Allocation Graph</p>
<p dir="auto">NOTE</p>
<p dir="auto">No assignment will be accepted after the due date via email in any case (whether it is the case of load shedding or internet malfunctioning etc.). Hence refrain from uploading assignment in the last hour of deadline. It is recommended to upload solution file at least two days before its closing date.</p>
<p dir="auto">If you find any mistake or confusion in assignment (Question statement), please consult with your instructor before the deadline. After the deadline no queries will be entertained in this regard.</p>
<p dir="auto">For any query, feel free to email at:<br />
<a href="mailto:cs604@vu.edu.pk" target="_blank" rel="noopener noreferrer nofollow ugc">cs604@vu.edu.pk</a></p>
<p dir="auto">Question No 01							                      8 Marks</p>
<p dir="auto">Consider a banking transaction system where two processes Cash Withdrawal and Cash Deposit for a bank account could take place at the same time. The Cash Withdrawal process helps in withdrawing some cash amount using the ATM and the Cash Deposit process is used to deposit some amount into the account through a cheque. Which synchronization technique should be adopted in order to make sure that these processes can take place mutually exclusive? Write pseudo-code or algorithm for these two processes.</p>
<p dir="auto">Note: No need to write code in any programing language.</p>
<p dir="auto">Question No 02							                   12 Marks</p>
<p dir="auto">Suppose a computer lab comprises of two printers, three scanners, and four ROM writers. There are three programs currently running on some computer. Assume program P1 is currently allocated a printer and two ROM writers and it is waiting for a scanner. Program P2 is allocated a scanner and it is waiting for a printer. Program P3 is allocated two ROM writers, a scanner, and a printer. Draw the corresponding resource allocation graph for these three programs. Also specify if the system is in a deadlocked state or not?</p>
<p dir="auto">Wish you very Best of Luck!</p>
]]></description><link>https://community.secnto.com//topic/1032/cs604-assignment-3-solution-and-discussion</link><generator>RSS for Node</generator><lastBuildDate>Mon, 08 Jun 2026 21:40:29 GMT</lastBuildDate><atom:link href="https://community.secnto.com//topic/1032.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 16 Jan 2020 10:40:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CS604 Assignment 3 Solution and Discussion on Wed, 22 Jan 2020 14:23:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/zareen" aria-label="Profile: zareen">@<bdi>zareen</bdi></a> said in <a href="/post/2774">CS604 Assignment 3 Solution and Discussion</a>:</p>
<blockquote>
<p dir="auto">Question No 02							                   12 Marks<br />
Suppose a computer lab comprises of two printers, three scanners, and four ROM writers. There are three programs currently running on some computer. Assume program P1 is currently allocated a printer and two ROM writers and it is waiting for a scanner. Program P2 is allocated a scanner and it is waiting for a printer. Program P3 is allocated two ROM writers, a scanner, and a printer. Draw the corresponding resource allocation graph for these three programs. Also specify if the system is in a deadlocked state or not?</p>
</blockquote>
<p dir="auto"><img src="https://i.imgur.com/fEvrDBH.png" alt="6b44c7a6-62dc-4070-a9b2-efc2d178cf0a-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">The system is not in deadlock state as it is clear from the above graph it is multi instance and circular weight.</p>
]]></description><link>https://community.secnto.com//post/3019</link><guid isPermaLink="true">https://community.secnto.com//post/3019</guid><dc:creator><![CDATA[zareen]]></dc:creator><pubDate>Wed, 22 Jan 2020 14:23:46 GMT</pubDate></item><item><title><![CDATA[Reply to CS604 Assignment 3 Solution and Discussion on Wed, 22 Jan 2020 14:04:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/zareen" aria-label="Profile: zareen">@<bdi>zareen</bdi></a> said in <a href="/post/2774">CS604 Assignment 3 Solution and Discussion</a>:</p>
<blockquote>
<p dir="auto">Question No 01							                      8 Marks<br />
Consider a banking transaction system where two processes Cash Withdrawal and Cash Deposit for a bank account could take place at the same time. The Cash Withdrawal process helps in withdrawing some cash amount using the ATM and the Cash Deposit process is used to deposit some amount into the account through a cheque. Which synchronization technique should be adopted in order to make sure that these processes can take place mutually exclusive? Write pseudo-code or algorithm for these two processes.<br />
Note: No need to write code in any programing language.</p>
</blockquote>
<p dir="auto"><strong>Solution Idea:</strong></p>
<pre><code>
The codes for reader and writer processes are shown below:

Semaphore mutex, cash;
int transaction;
transaction=0;
mutex=1;

cash=1;
wait(mutex);
transaction++;

if (transction == 1)

wait(cash);
signal(mutex);
cash=cash+1
...
Cash deposit process is performed
...

wait(mutex);
transaction--;
if(transaction == 0)
signal(cash);
signal(mutex);


wait(cash);
cash=cash-1;
...
Cash Withdraw is performed

...
signal(cash);


</code></pre>
]]></description><link>https://community.secnto.com//post/3018</link><guid isPermaLink="true">https://community.secnto.com//post/3018</guid><dc:creator><![CDATA[zareen]]></dc:creator><pubDate>Wed, 22 Jan 2020 14:04:25 GMT</pubDate></item></channel></rss>