Introduction to System Programming (Kernel (Kernel basic facilities …
Application Program v.s. System Software
focus on the particular application—machine independent
Provides services to user
intend to support computer operations and uses—machine dependent
Computer Architecture Abstraction Layer
OS and application :arrow_down:Kernel:arrow_down:Assembler:arrow_down:Firmware:arrow_down:Hardware
What is an operating system?
A program that acts as an intermediary between a user of a computer and the computer hardware.
Operating system goals:
Execute user programs and make solving user problems easier.
Make the computer system convenient to use.
Use the computer hardware in an efficient manner
Resource naming and location
Communication and synchronization
Security and protection
What is Unix?
It is an operating system
It is created in AT&T’s Bell Laboratories and evolved into what is known as “System V” UNIX
Unix is written in C language
It is easy to port to different hardware platform
What is Linux?
Linux is a freely distributed implementation of a UNIX-like kernel, the low-level core of an operating system.
Because Linux takes the UNIX system as its inspiration, Linux and UNIX programs are very similar.
Why we choose Linux for SP?
Versions of Linux are now available for a wide variety of computer systems using many different types of CPUs, including PCs based on Intel x86 and compatible processors; workstations and servers using Sun SPARC, IBM PowerPC, and Intel Itanium; and even some handheld PDAs and the Sony Playstation 2.
If it’s got a processor, someone somewhere is trying to get Linux running on it!
The kernel of an operating system is the part responsible for all other operations.
The kernel's primary function: manage the computer's resources and allow other programs to run and use these resources
Resources: CPU, memory, I/O, etc.
Kernels also provide methods for synchronization and communication between processes called inter-process communication (IPC).
Kernel (computing), the central component of most operating systems
The Linux kernel, used on many Linux-based operating systems
The Windows 9x kernel, used in Windows 95, 98 and ME
The Windows NT kernel, used in all Windows NT systems including Windows 2000, XP, Vista and 7
it is a bridge between applications and the actual data processing done at the hardware level.
Kernel basic facilities
What is system programming?
Art of writing system software
Is a branch of computer science that deals with the structure of a machine.
The structure of a machine may compose of memory, I/O, CPU, etc.
systems programming aims to produce software which provides services to the computer hardware
Why system programming?
essential to any kind of computing.
an important foundation for application development.
constantly evolving to accommodate changes in hardware.
hacking with unparalleled freedom.
cornerstones to system programming in Linux:
System programming starts with
System calls (often shorted to syscalls) are function invocations made from user space - your text editor, favorite game, and so on - into the kernel (the core internals of the system) in order to request some service or resource from the operating system.
the C library
The C library (libc) is at the heart of Unix applications.
Even when you’re programming in another language, the C library is most likely in play, wrapped by the higher-level libraries, providing core services, and facilitating system call invocation.
On modern Linux systems, the C library is provided by GNU libc, abbreviated glibc.
the C compiler
In Linux, the standard C compiler is provided by the GNU Compiler Collection (gcc).
Originally, gcc was GNU’s version of cc, the C Compiler.
Thus, gcc stood for GNU C Compiler.
Why we use C lang. for SP?
C is the language of system programmers.
All major OS are written in C (BSD, Linux, OS X, Windows).
C is a subset of C++
C and C++ together are used for more than 1/3 of all open source projects at SourceForge.