We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More

Assignment No. 01
Semester: Spring 2017
CS604: Operating System
Total Marks: 20
Due Date:01/05/2017
Instructions:
Please read the following instructions carefully before submitting the assignment. It
should be clear that your assignment will not get any credit if:
 The assignment is submitted after the due date.
 The submitted assignment does not open or file is corrupt.
 Assignment is copied (partial or full) from any source (websites, forums,
students, etc)
Note: Lecture No. 1 to 6 are covered in this assignment. You have to upload only .doc
file. Assignment in any other format (extension) will not be accepted and will be
awarded with zero marks.
Objective:
The objective of this assignment is to provide hands on experience of:
 To learn and understand the basic concept of an Operating System
 To learn Components, Services and Structures of Operating System
For any query about the assignment, contact at CS604@vu.edu.pk
Assignment
Assignment Questions:
Question#1: [05 Marks]
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
Access I/O Instructions
Question 2: [05 Marks]
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 <Ctrl-C>.
4. Yasir is typing Alphabets in notepad by hitting keystroke.
5. Bilal opening a folder from desktop by double clicking mouse.
Question 3: [10 Marks]
Understand the below program carefully and explain each line accordingly.
#include <stdio.h>
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……………………….}

+ Click Here To Join also Our facebook study Group.

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?


See Your Saved Posts Timeline

Views: 6491

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

Replies to This Discussion

yes

First main only point 3 is Non-Privileged while remaining is privileged

Turn off interrupts: PRIVILEGED. Only the OS should be in charge of setting the flow of control between the kernel and the user processes (except in the case of voluntary yielding).

Question 3 Answer.

#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

 

Mujha please batao k 2nd question k first main trap kun ata hai . kia ya code ma error hona ki wajah sa hai ya koi reason hai .?

because its a synchronous interrupt typically caused by an exceptional condition (trap) (e.g., breakpoint, division by zero, invalid memory access).

Bohat shukriya ..

Complete assignment Solution

Attachments:

Assalam O alaikum. 
Here is Idea solution of CS604 assignment No 1 spring 2017. 
All of You are requested please not just copy and paste but also give your feedback if anything confusing you either its true or false. 
Waiting for your comments.

Attachments:

Assignment No. 01

Semester: Spring 2017

CS604: Operating System

 

Total Marks: 20

 

Due Date:01/05/2017

Question#1: [05 Marks]

 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 

Non-Privileged

Turn off interrupts

Privileged

Issue trap instructions

Non-Privileged

System Call 

Privileged

Access I/O Instructions

Privileged

Question 2: [05 Marks]

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.

trap

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

trap

  1. While running a program, you press <Ctrl-C>.

signal

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

interrupt

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

interrupt

Question 3: [10 Marks] 

Understand the below program carefully and explain each line accordingly.

#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

of Luck

 

 

 

Q. 1

Instruction Name

Privileged

Non- Privileged

Clear Memory

Privileged

 

Turn off interrupts

Privileged

 

Issue trap instructions

 

Non-Privileged

System Call

 

Non-Privileged

Access I/O Instructions

Privileged

 

RSS

© 2019   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service