Introduction to operating system, system calls and interrupts

shivammitra 2,430 views 27 slides May 30, 2020
Slide 1
Slide 1 of 27
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27

About This Presentation

1.Topics to focus for OS interviews
2. Introduction to operating system with architecture diagram
3. Operating system vs Kernel
4. Examples of operating system and Kernel
5. System calls, context switch and interrupts


Slide Content

INTRODUCTION TO OPERATING SYSTEMS

AGENDA Introduce myself Operating system questions for interviews Introduction to operating system with example Kernel vs Operating System Examples of operating system and kernel Introduction to system calls Introduction to interrupts

Before proceeding further… Do not forget to subscribe to the channel. Share this with your friends(Saturday 5PM class IST) Telegram link: https://t.me/joinchat/OcDlRxsp56Z1yiqQJu9unw Email doesn’t scale - https://bit.ly/2LVLWWy Planning to take practical classes related to operating system(linux) Have doubts? Ask in comments or while I am live Will try explaining your doubts in next classes

Full classes schedule Introduction to operating system and what all topics to focus for interviews Process management (process vs program, process control block, process states, process lifecycle - fork(), exec(), wait(), exit(), zombie and orphan process) Interprocess communication (Multiprocessing, multithreading and challenges) Process Scheduling Algorithms Process synchronization(mutex, semaphore and deadlock) Memory management part 1(Virtual memory, physical vs logical address space) Memory management part2(Demand paging, page replacement algorithms) Miscellaneous(filesystem and other topics which were left)

ABOUT ME Site Reliability Engineer at LinkedIn(1.5 years) Former DevOps Engineer at Directi(1.5 years) Alumni of IIIT Allahabad Hobbies: Books(Finance + SRE), Cricket, Making youtube Videos

OPERATING SYSTEM QUESTIONS ASKED IN INTERVIEWS

SUBJECTIVE + MCQ MCQ Online test Subjective questions (F2F or telephonic interview) Mostly asked to candidates with no or less experience Software engineer + DevOps/SRE + Service based companies

Advantage of learning OS Knowledge Practical: Threads + mutex/semaphore + memory segments (Software) Practical: Zombie process + Nice values + Linux Commands Will discuss practical knowledge in my next series Edge overs others in interviews Directi Experience

What questions are asked? https://practice.geeksforgeeks.org/tag-page.php?tag=Operating%20Systems Will list down what questions can be answered by seeing my video Not easy to cover all the questions Will cover only important ones https://shivammitra.com/operating%20system/how-to-study-operating-systems/ Why not watch my other videos on operating system?

QUESTIONS WHICH YOU WILL BE ABLE TO ANSWER AFTER THIS VIDEO? What is operating system? Explain the architecture of operating system. Difference between operating system and kernel What are the functions of operating system Give some examples of popular operating system and kernel What are system call with examples What are interrupts with examples

What is an operating system? System program that manages the system’s hardware Acts as an interface between the user and the hardware Includes all the programs that are associated with the operation of the system What all are parts of an operating system?

Parts of an operating system No universal definition for what should be included. Include parts that are essential for the running of the system Parts of OS Kernel Device drivers User Interface System Libraries System utilities – disk formatters, network utilities, data recovery etc Are application programs(chrome, excel) part of the operating system? ( Microsoft vs United States )

Architecture diagram of operating system

The operating system(kernel) is helping in running the process. But if the process wants to talk to hardware, use system calls. Reading/writing to file Creating a new process/thread Allocate/deallocate memory Detailed Explanation - https:// youtu.be /6FqUzzVwm4E

What is a kernel? Kernel is the heart of the operating system Portion of the OS code that is always resident in main memory Functions of the kernel Process management Memory management File system management Protection and security Device management Inter process communication Operating system may become a kernel in some cases(embedded devices)

Functions of the operating system Kernel is a part of OS Kernel functions + Provide CLI/GUI for interaction with system Provide system utilities Provides system libraries Detailed explanation: https://youtu.be/IEL2smumOks

Examples of operating system and kernel Windows -> Windows NT -> 76% market share Mac OS -> XNU -> 19% market share Ubuntu, Redhat -> Linux -> 1.6% The above market share is for desktops In servers, Linux has 70% market share. Cars, watches, smart tv, smart phones(android), NASA? What do they have in common?

System Calls User applications use system calls to talk to the hardware. Operating system acts as an interface between users and hardware. Interface -> System call interface System calls are functions that are present in the C library( glibc ) Related videos: Introduction to system calls How system call works

Category of System Calls Process management – fork(), exec(), wait(), exit() Memory management – brk(), sbrk(), mmap() File system management – write(), read(), open(), close() Inter process communication – pipe(), socket(), connect(), send(), recv() These are for Linux operating system. Windows - https://www.tutorialspoint.com/different-types-of-system-calls

What are interrupts OS manages the hardware OS needs to communicate with hardware devices Should the OS wait for the communication from hardware devices? Press of keys on keyboards or writing to a file. Polling – kernel keeps on checking any updates from devices at regular time intervals. Drawback? Related videos: Introduction to interrupts How interrupt works

Interrupts (Continued) An interrupt is an input signal to the processor indicating an event requires immediate attention. The current process running on the processor gets interrupted. Interrupt handler code is then run. Types of interrupts Hardware interrupts Software interrupts

Hardware interrupts Issued by hardware device – keyboard, mouse, disks etc Can arrive at any time -> asynchronous interrupts

Hardware interrupts working

Software interrupts Issued by the processor itself Caused by program that is running on the processor -> synchronous interrupts System calls are also called using interrupts(traps) https:// youtu.be /UFBe1HdN8h0 Segmentation fault, page fault, divide by zero etc

Software interrupts working

Next class (Process management) How kernel runs your program? Program vs process Process control block Process states Process lifecycle(fork(), exec(), wait(), exit()) Zombie and orphan process