How To Exam?

a knowledge trading engine...


M.Sc-M.Sc Computer Science 2nd Sem CS - 202: Advanced Operating Systems(University of Pune, Pune-2013)

Friday, 28 November 2014 12:44Nitha

                                             M.Sc. (Semester - II)


SEAT No. :

[Total No. of Pages : 7


COMPUTER SCIENCE

CS - 202: Advanced Operating Systems

(2011 Pattern)

Time :3 Hours]                                                                                                 [Max. Marks :80

Instructions to the candidates :

1) All questions are compulsory.

2)       All questions carry equal marks.

3)       Neat diagrams must be drawn wherever necessary.

4)       Figures to the right indicate full marks.

Q1) Attempt all the following:                                                                    [8 × 2 = 16]

 

How file sharing is done in UNIX Operating System. Explain the system calls fsync () & fdatasync(). Explain Symlink () and readlink () functions.

Explain Components of register in context with the process.

Why are the logout records written by the init process? Is this handled in

the same way as network login?

Explain mincore () function.

What happens if a blocked signal is generated more than once before the

process unblocks the signal?

Describe the structure of an executive process block.


Q2) Justify the following (any eight):                                                       [8 × 2 = 16]


We can set only one of the two time values with the utime function. getcwd () is preferred than getwd() in applications.

No process can preempt another process executing in the kernel.

The kernel does a longjump to restore a previously saved context if it has

no way to complete the system call it is executing.

P.T.O.

 

A process never executes in user mode before handling outstanding

signals.

It is very important that any signal handler has to be very careful about the actions it performs and the data it touches.

Creating a Windows process consists of several stages.

Create Thread notifies the Windows subsystem about the new thread.

Thread priority levels are assigned from different perspectives.

The kernel never schedules Zombie process to execute.


Q3) Attempt any four of the following:                                                             [4 × 4 = 16]

 


Explain architecture of Unix Operating system with system Kernel in detail.

The following sequence of code has been observed in program.

dup2(fd,0);

dup2(fd,1);

dup(fd,2);

if(fd>2)

close(fd);

To see why the if test is needed, assume that fd is 1 and draw a picture

of what happens to the three descriptor entries and the corresponding file table entry with each call to dup2. Then assume that fd is 3 & draw the same picture.

Explain six values for param defined in <malloc.h> supported by Linux.

Explain the following functions sigaction(), sigpending().

Explain the kernel-mode components of Windows.


[4339]- 202                                                   2


Q4) Explain the behavior of following C Program (any four):

a)

#include<fcntl.h>

main(argc,argv)

int argc;

char*argv[ ];

{

int fd, skval;

Char c;

if(argc!=2)

Exit();

fd = open(argv[1],O_RDONLY);

if(fd= = –1)

exit();

while(skval= read(fd,&c,1)

{

print("char%c\n",c);

skval = lseek(fd,1023L,1);

printf("new seek val %d\n",skval);

}

}


[4 × 4 = 16]

[4339]- 202                                                   3

b)


#include <unistd.h>

#include <stdio.h>

#include <sys/types.h>

#include <sys/wait.h>

int main (void)

{

int status;

pid_t pid;

if (!fork( ))

return 1;

pid = wait (&status);

if (pid = = -1)

perror (''wait'');

printf ("pid=%d\n",pid);

if (WIFEXITED(status))

printf("Normalterminationwithexitstatus=%d\n",WEXITSTATUS(status));

if (WIFSIGNALED (status))

printf ("Killed by signal = %d%s \ n",WTERMSIG(status),

WCOREDUMP (status) ?" (dumped core)" :);

if (WIFSTOPPED (status))

printf("Stopped by signal=%d\n",WSTOPSIG (status));

if (WIFCONTINUED (status))

printf ("Continued\n");

return 0;

}


[4339]- 202                                                   4

c)                 void print_chars (int n, char c)

{

inti;

for (i = 0; i < n; i++) {

char *s;

int j;

s = calloc (i + 2, 1);

if (!s) {

perror ("calloc");

break;

}

for (j = 0; j < i + 1; j++)

s[j] = c;

printf ("%s\n",s);

free (s);

}

}

d)(Consider n=7 & c is *)

char string{} = "hello";

main()

{char buf[1024];

char * cp1,*p2;

int fds[2];

cp1 = string;

cp2 = buf;

while(*cp1)

*cp2++ = *cp1++;

[4339]- 202                                                   5

pipe(fds);

for(;;)

{

write(fds[1],buf,6);

read(fds[0],buf,6);

}

}

f)

#include<signal.h>

main()

{

register int i;

setpgrp();

for(i =0;i<10;i++)

{

if (fork ( ) = = 0)

{

if(i&1)

setpgrp ();

printf("pid=%d pgrp = %d\n"), getpid(),

getpgrp ());

pause();

}

}

kill(0,SIGINT);

}

[4339]- 202                                                   6

e) #include<signal.h>

main ()

{

int l,*ip;

extern f(), sigcatch() ;

ip = (int *)f;

for(i=0;i<20;i++)

signal(l,sigcatch);

*ip = 1;

printf("after assign to ip\n");

f();

}

f() { }

sigcatch(n)

int n;

{

printf("caught sig % d\n,n);

exit(1);

}

Q5) Write a C Program for the following: (Any four)                       [ 4 × 4 = 16]

 

Write a C Program to demonstrate use of Exit Handler.

Write a C Program that creates two files, one with a umask of 0 and one

with umask that disables all the group and other permission bits.

Write a C Program to demonstrate Race condition in catching Signals. Write a C Program to catch SIGUSR1 & SIGUSR2.

Write a C Program for a signal function that tries to prevent any interrupted

system calls from being restarted.

Write a C Program to illustrate use of pipe, dup & fork system call.

+++++++


 

 


( 0 Votes )

Add comment


Security code
Refresh

Earning:   Approval pending.
You are here: PAPER M.Sc-M.Sc Computer Science 2nd Sem CS - 202: Advanced Operating Systems(University of Pune, Pune-2013)