0% found this document useful (0 votes)
3 views

Operating system

Uploaded by

ngocmaicute0509
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Operating system

Uploaded by

ngocmaicute0509
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Introduction

Overview
Computer system structure
- App
- Operating system
- CPU, memory, I/O devices
Storage system
Storage system can be represented as a hierarchy of storage device medias
Difference between OS and kernel
The kernel is a program (object) that is part of the OS

Process and memory management is done in kernel while interfacing with the user
such as desktop icons or command line interpreters (terminals-cmd) are part of the
OS but not in the kernel.

The code of OS is accessed in kernel mode


The rest of software (user code), always runs in user mode.
Transition from user to kernel mode
System call: used to obtain services from the operating system

System calls
They are functions in the kernel that are called by a user program to execute kernel
code
System call at high level
- A user program is running until a system call interrupts it
- The system call is executed in kernel mode
- Once the system call is completed, user code resume execution in user mode
The printf() function is just an envelop that
- Prepare the arguments for the write() function
- Transfer these arguments to the kernel
- Last, execute the interrupt that stops the execution of the user code and pass
the control to a code in the kernel
Interrupts
Interrupt: Means to stop the execution of a sequence of computer instructions
While the CPU is executing a program, an interrupt stops the execution of this
program and start the execution of another program.
2 types of interrupts:
- Hardware
- Software: Caused by an error or a program want to voluntary interrupt itself

Hardware interrupts:
- Disk, network cards, keyboards, clock. Each device or set of devices will
have its own IRQ ( Interrupts request) line.
- Interrupts controller converts signals to a number and sent on the CPU IRQ
line.
- After execution each instruction, CPU checks the interrupt request line if an
interrupt has been raised.
- If an interrupt has occurred, the number of this interrupt is passed to kernel
to handle.
Software interrupts: 2 types:
- Normal: caused by software instructions such as a system call
- Exception: unplanned. For example, a value divided by 0, raise an interrupt
called an exception.
- Software interrupts do not reach the CPU, they are handled by the
kernel.
Handling interrupts:
- Different routines handle different interrupts – called
Interrupt Service Routines (ISR) (device drivers)
Linkers and loaders
Sourced code compile files designed to be loaded into any physical memory
location- relocatable object file
Linker combines these into single binary executable file
Must be brought into secondary memory storage as binary executable
Chapter 3: Processes
A process is:
- Storage for the text section of an executable file
- Storage for all the variables in the program
- Storage which come from the user space of main memory

You might also like