Lesson 4 - Interrups.pptx
Document Details
Uploaded by GentleArchetype
Bitaog Elementary School
Full Transcript
BASIC OPERATING SYSTEM CONCEPT O P E RAT I N G S Y S T E M I S A P R O G RA M T H AT M A N AG E S A C O M P U T E R ’ S R E S O U RC E S , E S P E C I A L LY T H E A L LO C AT I O N O F T H O S E R E S O U RC E S A M O N G O T H E R P R O G RA M S. T O U N D E R S TA N D I T D...
BASIC OPERATING SYSTEM CONCEPT O P E RAT I N G S Y S T E M I S A P R O G RA M T H AT M A N AG E S A C O M P U T E R ’ S R E S O U RC E S , E S P E C I A L LY T H E A L LO C AT I O N O F T H O S E R E S O U RC E S A M O N G O T H E R P R O G RA M S. T O U N D E R S TA N D I T DEEPER, KNOWLEDGE FROM BASIC O P E RAT I N G S Y S T E M C O N C E P T I S A N EDGE. INTERRUPTS Imagine you're playing a video game (that's your main task), but then you receive a notification on your phone (an interrupt). You pause the game to check the notification. The phone temporarily "interrupts" your game to handle the notification, and once you're done, you go back to playing. In a computer, an interrupt happens when the system needs to pause what it’s doing (like running a program) to handle something more urgent, usually related to Input/Output (I/O) devices like the keyboard or mouse. SEQUENCE OF INTERRUPTS: 1. Device sends an interrupt You press a key on the keyboard (let's say the letter "A"). The keyboard sends an interrupt to the CPU, signaling that a key has been pressed. 2. CPU acknowledges The CPU, while busy doing something else (like running background processes or handling other applications), acknowledges the keyboard interrupt, pausing the current task to handle the new input. SEQUENCE OF INTERRUPTS: 3. Device sends interrupt vector The keyboard sends an interrupt vector to the CPU, which is like sending the keycode for the "A" key, identifying what exactly triggered the interrupt. 4. CPU saves current state The CPU pauses whatever task it was working on, like rendering graphics in the background, and saves the current state of that task so it can return to it later. SEQUENCE OF INTERRUPTS: 5. CPU processes the interrupt The CPU processes the keypress from the keyboard and determines that it should display the letter "A" in the word processor. 6. Interrupt handled, return to original task After processing the keypress and displaying the letter "A" in your document, the CPU goes back to the previous task it was working on, like running background processes or handling other applications. SUPERVISOR CALLS Supervisor calls (or system calls) happen when the operating system is asked to perform certain tasks that need its authority, like interacting with hardware. Example: Copying a File Let’s say you want to copy a file on your computer. You can’t directly access the file system; instead, your computer's operating system (OS) has to do that for you. You issue a "supervisor call" by using commands like COPY or PASTE. The OS will: SUPERVISOR CALLS 1. Ask the OS to find the file: Like calling a librarian to locate a book. 2. OS checks if you have permission: Like the librarian checking if you're allowed to borrow that book. 3. Copy the file: If you're allowed, it copies the file. If not, it shows an error message. Every time you interact with files, the system behind the scenes is doing a lot of work to handle your requests. In real-time applications (like dragging and dropping files), the OS is constantly making supervisor calls for things like reading, writing, and opening files. MODES OF EXECUTION User Mode: This is the "normal" mode where applications run with limited permissions, so they can’t mess with critical parts of the system. Think of this like using a shared computer at the library: you can use it, but you can’t install or change any important software. Monitor Mode (aka Kernel Mode): This is when the OS has full control and can access hardware directly. Imagine the librarian has access to a room with restricted books that no one else can access. The OS needs this privilege to manage the system securely. Why is this important? If programs could always run in kernel mode, they could accidentally (or maliciously) damage the system by accessing parts they shouldn't. MULTIPROGRAMMING, SPOOLING, AND TIME SHARING These concepts deal with how the operating system handles multiple tasks at once. Multiprogramming: Imagine you’re watching Netflix, downloading a file, and writing a document all at once. The OS ensures the CPU has something to do at all times by switching between tasks quickly. If one task (like downloading) is waiting for data, the CPU can work on another task (like Netflix) without wasting time. MULTIPROGRAMMING, SPOOLING, AND TIME SHARING Spooling: Picture a printer in an office. When you send a document to print, the OS stores the document in a queue, so the printer can work through jobs one at a time. While the printer is busy with one document, the next one waits in line (the "spool"). Time Sharing: This is similar to multiprogramming but allows multiple users to use the same computer system at the same time. Imagine a teacher giving each student a few minutes on a shared computer. The computer switches between users so fast that everyone feels like they have full access, even though they’re sharing the system. BUFFERING A buffer is temporary storage that helps balance out differences in speed between two operations. Example: Think of a fast cashier at a grocery store (CPU) and a slow bagger (I/O device). To prevent the cashier from waiting on the slow bagger, items are placed in a basket (buffer) after being scanned. The bagger can then take items from the basket at their own pace, keeping both operations running smoothly. Zero Capacity: Imagine no basket at all. The cashier has to wait for the bagger to bag each item before scanning the next one. Bounded Capacity: There’s a basket with limited space. If the basket gets full, the cashier has to stop until there’s more room. Unbounded Capacity: There’s an infinite basket, so the cashier never has to stop, no matter how slow the bagger is. BUFFERING A buffer is temporary storage that helps balance out differences in speed between two operations. Example: Think of a fast cashier at a grocery store (CPU) and a slow bagger (I/O device). To prevent the cashier from waiting on the slow bagger, items are placed in a basket (buffer) after being scanned. The bagger can then take items from the basket at their own pace, keeping both operations running smoothly. Zero Capacity: Imagine no basket at all. The cashier has to wait for the bagger to bag each item before scanning the next one. Bounded Capacity: There’s a basket with limited space. If the basket gets full, the cashier has to stop until there’s more room. Unbounded Capacity: There’s an infinite basket, so the cashier never has to stop, no matter how slow the bagger is. THANK YOU Audi Alteram Partem Prof Juls