All Exams Test series for 1 year @ ₹349 only
Question

Match the following WINDOWS system calls and UNIX system calls with reference to process control and File manipulation.

Windows

UNIX

A. Create-process( )

I. Open( )

B. WaitForSingleObject( )

II. Close( )

C. CreateFile( )

III. Fork( )

D. CloseHandle( )

IV. Wait( )

The correct answer is

A - III, B - IV, C - I, D - II

Matching Windows and UNIX System Calls

Operating systems provide system calls to allow user programs to interact with the system's resources, such as creating processes, managing files, and handling input/output. While different operating systems like Windows and UNIX (and its variants like Linux) have their own unique sets of system calls, many fundamental operations have equivalent functions across systems, though the names and exact behaviors may differ.

This question asks us to match common Windows system calls related to process control and file manipulation with their closest equivalents in the UNIX system.

Understanding the System Calls

Let's look at the purpose of each system call listed:

  • Windows System Calls:
  • CreateProcess(): Used to create a new process. It loads a specified executable file into memory and creates a new process context.
  • WaitForSingleObject(): Used to wait until the specified object is in the signaled state or the time-out interval elapsed. When used with a process handle, it waits for the process to terminate.
  • CreateFile(): A complex function used for creating, opening, or getting handles to files, pipes, console input/output, and other devices.
  • CloseHandle(): Used to close an open object handle, releasing the resource. This applies to various object types, including file handles and process handles.
  • UNIX System Calls:
  • open(): Used to open or create a file or device. It returns a file descriptor, which is an integer used to refer to the open file.
  • close(): Used to close an open file descriptor, releasing the resource associated with it.
  • fork(): Creates a new process by duplicating the calling process. The new process (child process) is an exact copy of the calling process (parent process) except for unique process ID, parent process ID, and resource usage.
  • wait(): Used by a parent process to wait for one of its child processes to terminate. It can also retrieve the exit status of the terminated child.

Matching Equivalents

Based on the functionalities described, we can find the closest matches:

Windows System Call Functionality UNIX System Call Functionality Match
CreateProcess() Create a new process fork() Create a child process (duplicate of parent) A - III
WaitForSingleObject() (with process handle) Wait for a process to terminate wait() Wait for a child process to terminate B - IV
CreateFile() Open or create a file/device open() Open or create a file/device C - I
CloseHandle() (with file/process handle) Close an object handle close() Close a file descriptor D - II

Let's confirm the matches:

  • A. CreateProcess() maps to III. fork(): Both are used for creating new processes. While their mechanisms differ (fork() duplicates, CreateProcess() loads), they serve the fundamental purpose of initiating a new execution flow.
  • B. WaitForSingleObject() maps to IV. wait(): Both allow a parent process to synchronize with a child process, typically by waiting for its termination.
  • C. CreateFile() maps to I. open(): Both are primary system calls for accessing files and devices, either for reading, writing, or both.
  • D. CloseHandle() maps to II. close(): Both are used to release the resources associated with an open file or other system object, specified by a handle or descriptor.

The correct mapping is A - III, B - IV, C - I, D - II.

Revision Table: Windows vs UNIX System Calls

Windows System Call UNIX System Call Equivalent Category
CreateProcess() fork() Process Control (Creation)
WaitForSingleObject() wait() Process Control (Synchronization/Waiting)
CreateFile() open() File Manipulation (Opening/Creation)
CloseHandle() close() File Manipulation (Closing)

Additional Information on System Calls

System calls form the interface between a process and the operating system. They provide a controlled way for user-level programs to request services from the kernel, such as managing processes, accessing hardware, and handling files.

  • Process Control System Calls: These calls manage the lifecycle of processes. Examples include creating new processes, terminating processes, waiting for processes to finish, getting process information, and changing process priority.
  • File Management System Calls: These calls handle operations related to files and directories. Examples include creating, deleting, opening, closing, reading, writing, and seeking within files. They also include calls for managing directory structures.
  • Device Management System Calls: These calls interact with input/output devices.
  • Information Maintenance System Calls: These calls retrieve or set system information, like time or process ID.
  • Communication System Calls: These calls facilitate inter-process communication (IPC), allowing processes to exchange data.

Understanding the equivalence of system calls across different operating systems is important for programmers working in heterogeneous environments or studying operating system concepts.

Was this answer helpful?

Important Questions from File System

  1. A mechanism for arranging controlled access to a shared resource, like a file, is called:

  2. Which UNIX/Linux command is used to make all files and sub-directories in the directory “progs” executable by all users?

  3. In Linux operating system environment ________ command is used to print a file.

  4. Consider the following statements :

    (a) UNIX provides three types of permissions

    Read

    Write

    Execute

    (b) UNIX provides three sets of permissions

    permission for owner

    permission for group

    permission for others

    Which of the above statement/s is/are true ?

  5. File manipulation operations in an operating system include:

Need Expert Advice?

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App