Overview of System Programming

Page Contents

Define System Programming:

A modern computer has powerful capabilities such as a fast CPU, large memory, sophisticated input-output devices, and networking support. However, it has to be instructed through the machine language(system programming), which has strings of 0s and 1s as its instructions. A typical computer user does not wish to interact with the computer at this level. The system software is a collection of programs that bridge the gap between the level at which the user wishes to interact with the computer and the level at which the computer is capable of operating where system programming is necessary. System programming forms a software layer that acts as an intermediary between the user and the computer.

 

What is system programming?

 

System programming performs two functions: It translates the need of the user into a form that the computer can understand so that the user’s program can actually get executed on the computer. However the computer has more resources than needed by a program, many of its resources would remain idle while it is serving one program. To avoid this problem, the software layer gives idle resources to some other programs and interleaves the execution of all these system programs on the computer. This way, the computer can provide service to many users simultaneously.

 

Each program in the system software is called a system program. System programs perform various tasks such as editing a program, compiling it, and arranging for its execution. They also perform various tasks that a user is often unaware of, such as reading a program for execution by linking it with other programs and with functions from libraries and protecting a program against interference from other programs and users. The term system programming is used to describe the collection of techniques used in the design of system programs.

 

Language processor (for system programming)

A language processor is a system programming that bridges the gap between how a user describes a computation and how a computer executes a program.

Two kinds of language processors are used to implement a user’s computation. A System programming program generator converts the specification written by the user into a program in a procedure-oriented language, whereas a compiler or interpreter helps in implementing a program written in a system programming language.

 

We assume that each domain has a specification language. A specification written in a specification language is a program in that language. The specification language of the execution domain is the machine language of the computer system. We use the terms specification gap and execution gap as follows:

  • The specification gap is the semantic gap between the two specifications of the same task.
  • Execution Gap is the semantic gap between the semantics of programs that perform the same task but are written in different programming languages.

 

A semantic gap is bridged by converting a specification in one domain into a specification in another domain.

Program generation:

The program generator is a system programming program that accepts the specification of programming some language and generates a program in the target language that fulfills the specification. The execution gap between the target language and the execution domain is bridged by a compiler or interpreter for the system programming language.

A practical arrangement of language processors

 A practical arrangement of language processors

The important features of this arrangement are described below.

  • Pre-processors: one or more preprocessors may be used along with a translator for a system programming language to provide a superset of the system programming language’s features. The use of C++ pre-processors along with a C compiler enables the use of C++ language without having to develop a C++ compiler.
  • Using a sequence of translators: translation from a programming language to a machine language may be achieved by using two or more translators. The translator used in 1st step produces a target program that is not in the machine language(system programming). This targeted program is input to another translator, and so on until we obtain a target program that is in the machine language.
  • Linking and Loading: The target program obtained by translating a program written in a programming language requires the help of some other programs during its execution, eg., programs that perform input-output or standard mathematical functions. The linker is a system program that puts all these programs together so that they can execute meaningfully. The loader is a program that loads a ready-to-run program from a file into the computer’s memory for execution

Front end of toy compiler

 

The front end of toy compiler

Fig shows how tables and intermediate system programming codes are generated and used in the front end. Scanning and parsing are technical terms for lexical analysis and syntax analysis.

Lexical analysis (Scanning)

The lexical analysis considers the source program as a string of characters. It identifies strings that are lexical units, classifies them into different lexical classes, eg, operators, identifiers, or constants; and enters them into relevant tables. The classification is based on the specification of the source language. For example, an integer constant is a string of digits with an optional sign, an identifier is a string of letters, digits and special symbols whose first character is a letter, whereas a reserved word is a string that has a fixed meaning in the language. It builds an intermediate code that is a sequence of intermediate units called tokens, where a token is a descriptor for a lexical unit. A token contains 2 fields- lexical class and number in the class.

The back end performs memory allocation and code generation.

 

        the back end of toy compiler

 

Memory allocation

The back end computes the memory requirement of a variable from its type, length and dimensionality information found in the symbol table, and allocates memory to it. The address of the allocated memory area is entered in the symbol table.

Code generation

Complex decisions are involved in generating target code. Two decisions are as follows:

  1. What instructions should be used for each of the actions in the intermediate code?
  2. What CPU register should be used for evaluating expressions?

Basically, all these things count together and the system programming part is formed. Speaking in simple words system programming language is the language that is used for system programming. The system software is written by such language which requires a different approach towards development as compared to application software. One fine example of system software is an operating system, drivers, linkers, and loaders.

System programming software provides more direct access to system hardware. A typical programming language was BCPL. System programming languages often lack built-in input and output devices.

System Programming Books:

System Programming PDF:

Introduction to System Programming PDF

System Programming Course by stanford

System Programming In C:

Download PDF

creat( ), open( ), close( ) — managing I/O channels
read( ), write( ) – handling input and output operations
lseek( ) – for random access of files
link( ), unlink( ) – aliasing and removing files
stat( ) – getting file status
access( ), chmod( ), chown( ) – for access control
exec( ), fork( ), wait( ), exit( ) — for process control
getuid( ) – for process ownership
getpid( ) — for process ID
signal( ) , kill( ), alarm( ) – for process control
chdir( ) – for changing working directory

mmap(), shmget(), mprotect(), mlock() – manipulate low level memory attributes
time(), gettimer(), settimer(),settimeofday(), alarm() – time management functions
pipe( ) – for creating inter-process communication

S_IREAD — read permission for the owner
S_IWRITE — write permission for the owner
S_IEXEC — execute/search permission for the owner
S_IRWXU — read, write, execute permission for the user
S_IRGRP – read for group
S_IWGRP – write for group
S_IXGRP – execute for group
S_IRWXG – read, write, execute for the group
S_IROTH — read for others
S_IWOTH – write for others
S_IXOTH — execute for others
S_IRWXO – read , write , execute for others

O_RDONLY — opens file for read only
O_WRONLY – opens file for write only
O_RDWR – opens file for reading and writing
O_NDELAY – prevents possible blocking
O_APPEND — opens the file for appending
O_CREAT — creates the file if it does not exists
O_TRUNC — truncates the size to zero
O_EXCL – produces an error if the O_CREAT bit is on and file exists

Also, read more about system programming and operating system


int readline(char s[], int size){
char* tmp = s;
while (--size>0  &&read(0,tmp,1)!=0 && *tmp++ != '\n');
*tmp = '\0';
return (tmp-s);

}

How to Become a Systems Programmer?

A Bachelor’s Degree in Computer Science or any similar and equivalent level field is usually required to become a system programmer. Similar experience or demonstrated proficiency in job-related areas like operating systems languages can make up for the bachelor’s degree.

Basic Processing Unit: Computer Organization

Viva Questions: Operating System

File System Interface In Operating System…

Like us on Facebook

EntcEngg

Previous articleViva Questions: System Programming Operating System
Next articleObjectives of Industrial Management: Importance, Functions, Principles

LEAVE A REPLY

Please enter your comment!
Please enter your name here