Describing the syntax of time related system calls


Question 1) What is the output of the following program? What are the contents of file ‘test.txt’?

# include < stdio.h >
# include < fcntl.h >
Main ( )
{
int fd1, fd2, fd3 ;
fd1 = open ( “test.txt”, O–RDWR | O–TRUNC);
printf ( “ fd1 = %.d\n”, fd1);
write ( fd1, “Rose is’’, 7);fd2 = dup (fd1);
Printf ( “fd2 = %d \n”, fd2);
Write (fd2, “beautiful”,10) ;
Close (0);
fd3 = dup (fd1) ;
Printf ( “ fd3 = %d\n”, fd3) ;
Write ( 0, “flower”, 7) ;
dup2 (3,2) ;
write (2, “!\n” ), 2) ;
}

Question 2) Describe the behaviour and output of the following program:

Main ( )
{
int i ;
char * cp ;
extern char *sbrk ( );
cp = sbrk (10) ;
[3733]-202 3for ( i = 0 ; i < 10 ; i + + )
*cp ++ = ‘a’ + i ;
sbrk ( –10 ) ;
cp = sbrk ( 10 ) ;
for ( i = 0; i < 10 ; i ++)
Printf ( “ char % d = % c \n”, i, * cp ++) ;
}

Question 3) Describe fork swap and expansion swap.

Question 4) Answer in brief:

i) A delayed write is different from asynchronous write. Illustrate.

ii) Convert logical byte offset 1,25,000 into actual physical byte offset using bmap algorithm. Assume block size 1024 bytes.

Question 5) List and describe the syntax of time related system calls.

Question 6) Which are the actions taken by kernel while unmounting a file system?

Question 7) Consider block size = 512 bytes. Determine the offset, no. of bytes read in each of the following read statement.

Consider the statements are executed in the same process.

read (fd, buffer, 250) ;
read (fd, buffer, 400) ;
read (fd, buffer, 700) ;

Request for Solution File

Ask an Expert for Answer!!
Operating System: Describing the syntax of time related system calls
Reference No:- TGS05298

Expected delivery within 24 Hours