CS604 Assignment No 1 Spring 2017 | Virtual Study Solutions

Adsetra Ads

 

CS604 Assignment No 1 Spring 2017

Here we have complete CS604 - Operating System Assignment No 01 Spring 2017 Solution and Discussion. CS604 Assignment Due Date: 01/05/2017.
CS604 Assignment No 1 Spring 2017 - Solution and Discussion
CS604 Assignment No 1 Spring 2017 - Solution and Discussion
You Can Also CS604 Mid Term Papers, CS604 Short Notes, CS604 Assignment Solutions, Lecture Wise Questions Answers Files, CS604 Solved MCQs, Solved Quiz , CS604 Mid Term Subjective Papers , CS604 Mid Term Objective Papers from Virtual Study Solutions For Preparation of Mid Term Papers.

Recommended : CS101 Short Notes For Mid Term From Lec 1 To 22

CS604 Assignment Questions:

Totals Marks of CS604 Assignment No. 1 are 20 Marks. CS604 Assignment Due Date: 01/05/2017

CS604 Assignment Question No. 1: 

Marks = 5

Being an end user and an administration of any system, there are some privileges that have been given to you, suppose you are going to take the initial test as an operating system developer then specify which of the following instructions should be “Privileged” and “Non- Privileged”?

Instructions Name Privileged Or Non-Privileged

Clear memory

Turn off interrupts

Issue trap instructions

System Call

AccessI/O Instructions

Recommended : CS304 Assignment No 01 Spring 2017

CS604 Assignment Question No. 2: 

Marks = 5

Categorize the following examples into some events that cause the kernel code to invoke in order to manage computer resources (like I/O devices, memory and storage management) and control user programs to prevent errors and improper use of a computer system. That event could be an Interrupt, signal and trap:

1. Ahmad write a code in c language, like a=b/0.

2. Ayesha is compiling a C program an error occurs Invalid memory access or buffer overflow.

3. While running a program, you press .

4. Yasir is typing Alphabets in notepad by hitting keystroke.

5. Bilal opening a folder from desktop by double clicking mouse.

Recommended : HTML Tags with Examples Complete Tutorial

CS604 Assignment Question No. 3: 

Marks = 10

Understand the below program carefully and explain each line accordingly.

#include

void main ( )

1………………… {

2……………………….int pid, status;

3……………………….pid = fork ( );

4……………………….if (pid = = -1)

5……………………… {

6……………………………printf(“fork failed\n”);

7……………………………exit(1) ;

8……………………….}

9………………………if (pid = = 0)

10……………………… {

11………………………... printf( “Child here ! \n”);

12………………………... exit (0);

13……………………….}

14……………………….else

15……………………… {

16………………………… wait (&status);

17………………………… printf(“well done kid !\n”);

18………………………… exit (0);

19……………………….}

20………………….}

CS604 Assignment No 01 Solution:


The Solution idea of Cs604 Assignment no 1 is Suggested by Shahid Ali Bhatti . Give your remarks in Comments below:

CS604 Assignment Question no 1 Solution Idea

CS604 Assignment Question no 1 Solution Idea
CS604 Assignment Question no 1 Solution Idea

CS604 Assignment Question No 1 Solution:

The following operations need to be privileged: clear memory, turn off interrupts, access I/O Instructions. The rest can be performed in user mode.


Name Privileged
Non-Privileged
Clear memory  
Clear Memory

Turn off interrupts
Turn off Interrupts

Issue trap instructions

issue trap instructions
System Call 

System Call 
Access I/O Instructions  
Access I/O call


Turn off interrupts : Privileged so that a process cannot monopolize the CPU

 CS604 Assignment Question no 2 Solution 

CS604 Assignment Question no 2 Solution Idea
CS604 Assignment Question no 2 Solution Idea

CS604 Assignment Question NO 3 Solution


#include <stdio.h> void main ( )

1………………… {

Starting the main


2……………………….int pid, status;

Two integers declared


3……………………….pid = fork ( );

Fork function is called, after processing returned data saved into pid

4……………………….if (pid = = -1)

If condition if pid equal to -1


5……………………… {

Entering into if condition


6……………………………printf(“fork failed\n”);

Will be printed fork failed

7……………………………exit(1) ;

Terminate program


8……………………….}

End of if


9………………………if (pid = = 0)

Starting if condition, if pid equal to 0


10……………………… {

Entering into if condition


11………………………... printf( “Child here ! \n”);

Will be print on screen child here!

12………………………... exit (0);

Terminate program


13……………………….}

End of if statement


14……………………….else

Else start


15……………………… {

Entering into else statement


16………………………… wait (&status);

Wait function is called and address status is passed as a parameter


17………………………… printf(“well done kid !\n”);

Will be printed well done kid!


18………………………… exit (0);

Terminate program

19……………………….}

End of else statement

20………………….}
End of main


Recommended : What is Network Topology and its Types - Complete Tutorial

If You liked This Post Please Share it with Your Fellow Virtual University Students. Sharing is Caring. Thank You.

Post a Comment

 

Top