CSC 401 MidSem Spring 2023-2024 Operating Systems
CSC 401 MidSem Spring 2023-2024 Operating Systems
/CSE/4th Sem-M/2024/CSC401
Indian Institute of Information Technology Kalyani
Mid Semester Examination, Spring 2023 - 2024
Subject: Operating Systems Time: 90 Mins.
Paper Code: CSC401 Full Marks: 30
Instructions:
[1]. Answer all questions and each answer should be in your own words, otherwise, you will be awarded
zero mark. [2] All parts of a question should be answered consecutively. [3]. Answer the questions to the
points. [4]. Answer script should be neat and clean. [5]. Do not write anything on the question paper.
[6]. Number of pages in the question paper: 02.
(a) How does DMA reduce CPU Overhead in data transfer operations involving peripherals like disk
drives and network interfaces?
(b) Write two purposes for which Memory Buffer Register (MBR) is used in a computer system.
(d) Write two significant differences between a multi-programming system and a multi-tasking system.
(e) How many times “IIIT Kalyani” will be printed by all the child processes?
int main()
{
if(fork()&& fork())
fork();
printf(“IIIT Kalyani”);
return 0;
}
(a) Write a C program that creates a n number of child processes using the fork() system call. Each
child process should print its process id and its parent’s id. The parent process should wait for
all child processes to terminate before exiting. The number of child processes to create should be
specified as a command-line argument.
(b) Write a C program (to copy a file) to simulate the following command copy oldfile newfile
typed by an user at the terminal. Here oldfile is the name of the existing file whose contents to
be copied to the file newfile.
(c) Write a C program that opens a file named abc.txt, and writes “IIIT Kalyani” to it using the
system call write(). Use the system call lseek() to set the file offset to the beginning of the file
and reads the content using the system call read().
(d) Write a C program that display all the file from the current working directory.
1
Q3. State the reasons for the following situations. [2 × 2 = 4]
(a) Create a shared memory of 1024 bytes for private communication between two processes, and attached
it with the process created it.
(b) Detached the created shared memory from the process space, and it from the system.