System call and System program play an important role in the functioning of the operating system. As these constructs define what functions the operating system must perform.
The system call creates an interface between the user program and the services of the operating system. On the other hand, the system program defines the user interface of the operating system.
The system program also creates a suitable environment for a program to develop and execute. For example, the modern operating system comes with the system programs such as assembler, compiler, editor, loader, etc. These programs allow the programmers to develop and execute new programs.
So in this section, we will be discussing the differences between system calls and system programs. We will also be discussing both the terms in detail along with their types and examples.
Content: System Call Vs System Program
- Comparison Chart
- What is a System Call?
- What is a System Program?
- Types of System Call and System Program
- Sequencing in Operating System
- Key Differences
- Conclusion
Comparison Chart
Basis for Comparison | System Call | System Program |
---|---|---|
Basic Concept | Allow user process to request the services of operating system. | Creates an environment for program to develop and execute. |
User View | Defines interface to the services of operating system. | Defines a user interface of operating system. |
Request | It satisfies the low-level request of user program. | It satisfies the high-level request of the user program. |
Action | Invokes the services of operating system. | Initiates a sequence of system calls for to satisfy a user request. |
Language Used | Usually written in C and C++. But where direct hardware access is required the call is written using assembly level language. | System program are written in high-level languages only. |
Classification | Process control, file manipulation, device manipulation, information maintenance, communications, and protection. | File management, status information, file modification, Programming-language support, program loading and execution, communication |
What is a System Call?
A system call is a routine, function, or call invoked to perform operating system services such as:
- Process Control
- Device management
- File management, etc.
A system call creates an interface between the user process and the services offered by the operating system. So, the user process can directly communicate with the operating system and request the service it requires.
While developing an application program or the system program the developer needs to embed these system calls in the code. This helps the program in utilizing the services of the operating system. Each operating system has its own set of system calls that decides what operations the operating system is able to perform.
Example of System Call
How Does a System Call Work Here?
To copy the content of one file to another the user program invokes a sequence of system calls that helps in performing this task. These sequence of system calls are executed in the following way in an interactive system:
- Prompt a message on the screen for the user to provide the name of the source and destination files.
- Read the name of the source and destination file character by character from the keyboard.
- Open a source file. Open (and if not available Create) the destination file.
- Read from the source file and write to the destination file.
- Close the source and destination file.
- Prompt a message that displays the successful execution of the program.
- Terminate the user program.
You can observe to perform such as simple task seven system calls were executed. Although here we have not discussed encountering any error condition, it might have increased the call count.
What is System Program?
Along with the system calls the modern operating system comes with a collection of system programs. These programs are designed to satisfy common user requests such as:
- File management and modification
- Support for various programming languages
- Program loading and execution, etc.
The user requests are translated to the sequence of system calls that further invokes the corresponding operating system service satisfying the user request.
We also refer to system programs as system utilities. This is because it creates a suitable environment for the programs to get developed and executed.
However, it is the system program that defines the user interface of the operating system instead of the system call. To better understand this statement, let us consider an example.
Example of System Program
A user is running the Mac OS X operating system. The user’s view of the operating system will have a mouse-and-windows interface. One of the windows has a command-line UNIX Shell.
You can do this using two programs: –
- Either by using the mouse-and-windows interface.
- Or by using the command-line UNIX Shell.
Now both of these system programs use the same set of system calls. Still, the system calls act differently for both the system program. Here, the system program creates a view for the user, not the system call.
Types of System Call and System Program
System calls and system programs can be classified further into different categories based on the type of request they satisfy.
Types of System Calls
- Process Control
This system call is used for controlling process-related operations such as:
- end, abort
- load, execute
- create process, terminate process
- get process attributes, set process attributes
- wait for time
- wait event, signal event
- allocate and free memory
- File Manipulation
This system call helps in manipulating the file stored on disk. The manipulation includes:
- create file, delete file
- open, close
- read, write, reposition
- get file attributes, set file attributes
- Device Management
This system call allows the process to use certain system resources such as main memory, disk drives, access to files, etc.
- request device, release device
- read, write, reposition
- get device attributes, set device attributes
- logically attach or detach devices
- Information Maintenance
This system call is used by the user program to get the system information such as:
- get time or date, set time or date
- get system data, set system data
- set process, file, or device attributes
- get process, file, or device attributes
- Communications
The user program uses the system call to connect two processes, two users or systems.
- create, delete communication connection
- send, receive messages
- transfer status information
- attach or detach remote devices
- Protection
This system call creates a mechanism that controls the process access to the resource of the system.
Types of System Programs
- File Management
These system programs manage the operations related to files such as:
- Create file
- Delete file
- Copy file
- Rename file
- Dump file
- List, etc.
- Status Information
These system programs are used to retrieve the information about the system such as:
- Date
- Time
- Memory
- Number of users, etc.
- File Modification
These system programs are used for modifying the file stored on the hard disk or other storage devices. Other than modification these programs are also used to search some content on the file, or even to transform some content of the file. - Programming-Language Support
Some common system programs that support the programming languages like C, C++, Java, Visual Basic and Pearl come with the operating system. These system programs are:
- Compiler
- Assembler
- Debuggers
- Interpreters, etc.
- Program Loading and Execution
Whenever we write a program we compile it and store it on the disk. Now when we want to execute it we have to load it to the main memory. For this, we require some system programs such as:
- Loader
- Relocatable loader
- Linkage editor
- Overlay loader
- Communication
These kinds of system programs are used for connecting two communicating processes, users, and computer systems.
Sequencing of System Program and System Call in Operating System
Key Differences Between System Call and System Program
- Basically, the system call allows a user process to make a request to the operating system for utilizing its services. Whereas, the system program serves the common user request and creates an appropriate environment for a program to develop and execute efficiently.
- System call defines the interface between the user process and the services offered by the operating system. However, the system program defines the user view of the operating system.
- System call invokes the service of the operating system requested by the user process. On the other hand, the system program translates the user request into a sequence of system calls required to satisfy the request.
- The programmer writes system calls in high-level languages such as C and C++. The calls that directly access the hardware of the system are written in assembly level language. Conversely, the programmer writes system programs in a high-level language only.
- The system program accepts the high-level request made by the user program. It translates that request into a sequence of low-level requests. Further, the system call satisfies these low-level requests.
- We classify system calls into process control, file manipulation, device manipulation, information maintenance, communications, and protection. We classify the system program into file management, status information, file modification, programming-language support, program loading and execution, and communication.
Conclusion
Every operating system has its own set of system calls that define what the operating system does. These calls invoke system services requested by the user program. On the other hand, the system program satisfies the common requests made by the user programs.
Leave a Reply