Professional Documents
Culture Documents
PROGRAMMING
LECTURE # 1
INTRODUCTION TO SYSTEM PROGRAMMING
1
COURSE INFO. & LECTURE SCHEDULE
3
GRADING POLICY
4
TEXT & REFERENCE BOOKS
5
COURSE INTRODUCTION
6
AGENDA FOR TODAY
Course Introduction
Application Programming vs System Programming
Discussion on course outline
7
WHAT IS SYSTEM PROGRAMMING?
9
A BASIC C PROGRAM
int main()
{
int c;
while ((c = getchar()) != EOF)
putchar(c);
return 0;
}
10
SYSTEM PROGRAMMER PERSPECTIVE
Many users running multiple programs
Accessing lots of disk files
Needs to access different devices
More and more connections
11
SYSTEM PROGRAMMER PERSPECTIVE
The role of Operating System is to
manage all these resources and to
connect various devices to the correct
programs.
Operating System Kernel act as a
resource manager and facilitates the
process or user by avoiding a direct
hardware access.
12
APPLICATION PROGRAMMING VS
SYSTEM PROGRAMMING
13
THE CORE OPERATING SYSTEM:
THE KERNEL
The term operating system is commonly used with two different
meanings:
To denote the entire package consisting of the central software
managing a computer’s resources and all of the accompanying
standard software tools, such as command-line interpreters,
graphical user interfaces, file utilities, and editors.
More narrowly, to refer to the central software that manages and
allocates computer resources (i.e., the CPU, RAM, and devices).
Although it is possible to run programs on a computer without a kernel,
the presence of a kernel greatly simplifies the writing and use of other
programs, and increases the power and flexibility available to
programmers. The kernel does this by providing a software layer to
manage the limited resources of a computer.
14
TASKS PERFORMED BY THE KERNEL
15
SYSTEM PROGRAMMING
Executable
Program
Library
Function User Mode
Kernel Mode
System
Call
Printer Functions
Kernel
printf()
scanf() Hardware
fopen()
16
SYSTEM PROGRAMMER PERSPECTIVE
18
SYSTEM CALLS
System call is the controlled entry point into the kernel code, allowing a
process to request the kernel to perform a privileged operation.
Before going into the details of how a system call works, following points
need to be understood:
A system call changes the processor state from user mode to kernel
mode, so that the CPU can access protected kernel memory
The set of system calls is fixed. Each system call is identified by a unique
number
Each system call may have a set of arguments that specify information to
be transferred from user space to kernel space and vice versa
19
SYSTEM CALL INVOCATION
Basic Calling
sequence of a system
call
Paths to enter kernel
code are interrupts,
traps, signals and
system calls
20
SYSTEM CALL INVOCATION
21
COURSE OUTLINE
In this course we shall learn to use the services provided by the
kernel using Linux OS API,
Library Functions vs System Calls
Basic I/O
File Information System Calls
Programs with command line arguments
Process Management and Scheduling
UNIX IPC Tools
IPC Shared Memory
Thread Management and Synchronization
Sockets
Network Programming
22
Reading material:
23
THE END
LECTURE # 1
24