Os Important Topics
Os Important Topics
Ans: System calls provide an interface to the services made available by an operating system. These
calls are generally available as routines written in C and C++, although certain low-level tasks
(for example, tasks where hardware must be accessed directly), may need to be written using
assembly-language instructions.
System calls can be grouped roughly into six major categories: process control, file manipulation,
device manipulation, information maintenance, communication, device manipulation,
information maintenance, communications, and protection.
Process Control
A running program needs to be able to halits execution either normally (end) or abnormally
(abort). If a system call is made to terminate the currently running program abnormally, or if
the program runs into a problem and causes an error trap, a dump of memory is sometimes
taken and an error message generated. Under either normal or abnormal circumstances, the
operating system must transfer control to the invoking command interpreter. The command
interpreter then reads the next command. In an interactive system, the command interpreter
simply continues with the next command; it is assumed that the user will issue an appropriate
command to respond to any error. In a GUI system, a pop-up window might alert the user to
the error and ask for guidance. In a batch system, the command interpreter usually terminates
the entire job and continues with the next job. A process or job executing one program may
want to load and execute another program. This feature allows the command interpreter to
execute a program as directed by, for example, a user command, the click of a mouse, or a
batch command. This is related to the problem of whether the existing program is lost, saved,
or allowed to continue execution concurrently with the new program. There are so many
facets of and variations in process and job control that shows two examples. One is involving a
single-tasking system (MS-DOS) and the other a multitasking system (UNIX).
File Management
Now identify several common system calls dealing with files. First, need to be able to create
and
delete files. Either system call requires the name of the file and perhaps some of the file's attributes.
Once the file is created, it needs to open it and to use it. It may also read, write, or reposition
(rewinding or skipping to the end of the file, for example). Finally, it needs to close the file,
We have a directory structure for organizing files in the file system. In addition, for either files or
directories, we need to be able to determine the values of various attributes and perhaps to reset
them if necessary. File attributes include the file name, file type, protection codes, accounting
information, and so on. At least two system calls, get file attribute and set file attribute, are required
for this function. Some operating systems provide many more calls, such as calls for file move and
copy. Others might provide an API that performs those operations using code and other system
calls, and others might just provide system programs to perform those tasks.