System Programming Instructor Arshi Khan Copyright Arshi Khan Course contents           System programming overview Application Vs System Programming System Software Operating System Device drivers OS calls Windows system programming for Intel386 Architecture Virtual.

Download Report

Transcript System Programming Instructor Arshi Khan Copyright Arshi Khan Course contents           System programming overview Application Vs System Programming System Software Operating System Device drivers OS calls Windows system programming for Intel386 Architecture Virtual.

System Programming
Instructor
Arshi Khan
Copyright Arshi Khan
1
Course contents










System programming overview
Application Vs System Programming
System Software
Operating System
Device drivers
OS calls
Windows system programming for Intel386 Architecture
Virtual Machine
Virtual Device Driver
Module Management
Copyright Arshi Khan
2
Computer Software



consisting of programs, enables a computer to
perform specific tasks, as opposed to its physical
components (hardware) which can only do the tasks
they are mechanically designed for.
application software which perform productive
tasks for users,
system software which interface with hardware to
run the necessary services for user-interfaces and
applications, and middleware which controls and
co-ordinates distributed systems.
Copyright Arshi Khan
3
Cont..
computer systems divide software
systems into three major
classes:



system software.
programming software.
application software.
Copyright Arshi Khan
4
Computer Programming



process of writing, testing, and maintaining the
source code of computer programs.
The source code is written in a programming
language. This code may be a modification of
existing source or something completely new.
The process of writing source code requires
expertise in many different subjects, including
knowledge of the application domain, specialized
algorithms, and formal logic.
Copyright Arshi Khan
5
Foundation of System Programming
Copyright Arshi Khan
6
What is System Programming?





is the activity of programming system software.
produce software which provides services to the computer
hardware (e.g. disk defragmenter).
requires a greater degree of hardware awareness.
Implementing certain parts in operating system and
networking requires systems programming
 (for example implementing Paging (Virtual Memory) or a
device driver for an operating system).
The primary distinctive characteristic of systems
programming when compared to application programming is
that systems programming requires a greater degree of
hardware awareness.
Copyright Arshi Khan
7




More specifically:
the programmer will make assumptions about the hardware and other
properties of the system that the program runs on, and will often exploit
those properties.
usually a low-level programming language or programming language
dialect is used that:
 can operate in resource-constrained environments
 is very efficient and has little runtime overhead
 has a small runtime library, or none at all
 allows for direct and "raw" control over memory access and control flow
 lets the programmer write parts of the program directly in assembly
language
debugging can be difficult if it is not possible to run the program in a
debugger due to resource constraints. Running the program in a simulated
environment can be used to reduce this problem.
Copyright Arshi Khan
8
Application Programming




Computer programming (often simply programming) is the
craft of implementing one or more interrelated abstract
algorithms using a particular programming language to
produce a concrete computer program.
Programming has elements of art, science, mathematics, and
engineering.
is the process of writing, testing, and maintaining the source
code of computer programs. The source code is written in a
programming language.
writing source code requires expertise in many different
subjects, including knowledge of the application domain,
specialized algorithms, and formal logic.
Copyright Arshi Khan
9
General hardware organization of a computer system
Memory
Memory
Memory
Card read/punch
CPU
CPU
Disk
Teletype
Printer
Copyright Arshi Khan
10
Programming system components







Assemblers
Loaders
Subroutines
Relocating
Macros
Compilers
Formal Systems
Copyright Arshi Khan
11
Evolution of Operating System
Copyright Arshi Khan
12
Operating System
Copyright Arshi Khan
13
Operating System






software that manages the sharing of the resources of a computer.
An operating system processes raw system and user input and responds by
allocating and managing tasks and internal system resources as a service to
users and programs of the system.
An operating system performs basic tasks such as controlling and
allocating memory, prioritizing system requests, controlling input and
output devices, facilitating networking and managing file systems.
Most operating systems come with an application that provides an
interface to the OS managed resources.
Operating Systems themselves have no user interfaces.
The operating system forms a platform for other system software and for
application software.
Copyright Arshi Khan
14
Disk Drivers
Device driver is a specific type of computer software developed to allow
interaction with hardware devices. Typically this constitutes an interface
for communicating with the device, through the specific computer bus or
communications subsystem that the hardware is connected to, providing
commands to and/or receiving data from the device, and on the other
end, the requisite interfaces to the operating system and software
applications. It is a specialized hardware-dependent computer program
which is also operating system specific that enables another program,
typically an operating system or applications software package or
computer program running under the operating system kernel, to interact
transparently with a hardware device, and usually provides the requisite
interrupt handling necessary for any necessary asynchronous timedependent hardware interfacing needs.
Copyright Arshi Khan
15
System calls
Copyright Arshi Khan
16
Operating System Calls (OS Calls)





OS calls/system call is the mechanism used by an application program to
request service from the operating system.
System calls often use a special CPU instruction which causes the processor
to transfer control to more privileged code, as previously specified by the
more privileged code.
When the system call is invoked, the program which invoked it is interrupted,
and information needed to continue its execution later is saved.
The processor then begins executing the higher privileged code, which, by
examining processor state set by the less privileged code and/or its stack,
determines what is being requested.
When it is finished, it returns to the program, restoring the saved state, and
the program continues executing.
Copyright Arshi Khan
17
There are dozens of system calls supported any
Linux or UNIX kernel. Some common examples
include:
 file I/O:
 process control: memory management:
 time management:
 interprocess communication (IPC):
Copyright Arshi Khan
18