User Interface (CUI / GUI) and System Calls in OS

472

User Interface popularly known for its short-form UI provides a way for users to interact with the Operating System. There are many different types of user interfaces among which two are the most common and widely known. The first one is the Command Line Interface (CUI) and the second one most of us use i.e., Graphical User Interface (GUI). Now, let us learn about each of these in detail –

Command Line Interface

We all have seen the CMD in windows, where a black screen appears and the user can perform tasks through it by entering commands. This is an example of a Command Line Interface.

command line interface CUI
command line interface CUI

Some operating systems such as UNIX have this kind of interface for every operation. The command interface is started as soon as the user logs on to the system. Also, in some of these operating system more than one kind of command-line interface which are known as the shell. Such as bourne shell, corn shell, and C shell in UNIX among which the user can select any of these and work on them.  The inner functionality of most of these shells is similar and users can select and use any of them. Also, the user can download third-party shells for their use.

There are two different approaches for command execution through a command line interface. The first approach is where the command line itself contains the code for different kinds of commands. In this case, the number of codes determines the size of the command line interface. And in the second approach, the command interpreter does not understand any kind of command. It loads a file for the specific commands into the memory and executes those.

Graphical User Interface

The command line interface seems to be a bit difficult for many users as the user must be aware of the commands to use it. So, to make the use of the operating system easy, a special interface is provided where a pointing device called a mouse is moved on the screen and taken to the file or directory that needs to be used. The input is given through the keyboard and icons are provided for each purpose which makes the use very easy.

Graphical User interface

A user interface can vary from to system and even user to user within a system.

System Calls

System calls are the instruction that is given to perform each task in a system. Even a simple task such as opening a file needs many system calls.

For example, we will consider a program to copy the input from one file to another file. At first, it is needed to take the name of the input and output files as input from the user. So, a prompt will be needed to appear on the screen telling the user to input the name of these files. This will require a system call. Then, the user will input the names. This will require a system call. Then, the input file is located. If it is not found at the desired location, the error is generated which is a system call to throw an error. And If the output file is not created due to any reason, then again a system call is. In

this way, many system calls arise even for a small process. And there are thousands of processes going on in a system. So, there will be a large number of system calls.

Also Check: segmentation in os

The user needs not to know about the system calls. These are managed by the Application Programming Interface (API) which includes the functions required for a system call. On the behalf of the user, the functions that make up an API invoke the system calls. Further, we see in detail there is a system-call-interface that intercepts the function to call in the API and connects to the required system call.

Types of System Calls

There are six different categories of system calls based on their working. Below, we will discuss each of these in detail –

Process Control

A program completes its execution either abnormally or normally. If an error is generated, it means the program is executed abnormally or unsuccessful execution. In this case, the memory dump is stored in the secondary memory which can be later used to identify the cause of error or debugging. Then, the command interpreter reads the input from the user for what to do after the error code. In some operating systems, the command interpreter asks for the next instruction whereas, in some, the GUI interface pops up. In other cases such as batch OS, the interpreter terminates the process and starts the next process.

Also Read: optimal page replacement algorithm

Process Control contains the following commands –

  • Abort
  • Load
  • Execute
  • Create Process
  • Wait

File Management

In the system, all the data is stored in the files. First, we need to create a file or delete a file. Then, we need to open the file. Then we need to read the data or write to the file. And after completion of our work, the file needs to be closed. So, all these operations need system calls. Such system calls come under file management-related system calls. These include –

  • Create file
  • Delete file
  • Read from file
  • Write to file
  • Reposition

Device Management

As we already know that each process requires some resources to execute. If the resources are available for a process, the process executes successfully otherwise waits for the resource.

Also Check: Pagining in OS

These resources can be thought of as devices that a process needs. Before starting to read and write from a device. First, it is needed to request the device. Then if it is available, we can read/write to the device and after it, can be closed. This can be thought similar to a file that needs to be opened and closed.

The various device management-related system calls are –

  • Request device
  • Release device
  • Read
  • Write
  • Attach
  • Detach

Information Management

There are certain system calls that exist for the sharing of information between the user programs and operating systems. For example, the system calls to show the current date and time or the number of active users, etc. This kind of system calls comes under the category of information management. System calls for information management include –

  • Get date
  • Get time
  • Get process
  • Get users, etc.

Communication

There is a need for communication between processes of the same system or between one system to another. There are two different approaches to communication. The first one is by message passing where a connection needs to be set up and each connection has a hostname and IP address. And, the information is shared in the form of small packets.

Another approach is shared memory where shared memory is used by multiple systems.

The system calls for communication are –

Create Connection

Delete connection

Send messages

Delete Messages, etc.

So, in this article, we learned about the different types of user interfaces and system calls.

Also check: LRU Page Replacement Algorithm in Operating System

Previous QuizOperating System Services
Next QuizTypes of system programs in os

1 COMMENT

  1. Ok, this is an informative piece of writing, and since I am working with Logo Designer PK in Karachi, this can also be useful for my other fellows, as it contains valuable and informative content. Thanks for allowing us to read it.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.