Types of Semaphores
Duration: 8 min
This video lesson is available to enrolled students.
Inside: a video lesson and guided study material.
Module outline
- Quantitative Ability: Speed Mathematics and Basic Mathematics, Percentage, Ratio and Proportion (Ratios), Average, Profit and Loss, Simple Interest and Compound Interest, Time and Work, Pipe and Cistern, Speed Time and Distance, Number System, HCF LCM, Data Interpretation, Age Problems, Mixture and Alligation, Partnership, Algebra, Sequence and Series (Series), Mensuration and Geometry, Arithmetic
- Reasoning Ability: Puzzle Solving (Puzzles), Seating Arrangements, Coding Decoding, Blood Relations, Directions (Direction Test), Syllogisms, Data Sufficiency, Ranking, Order and Sequence, Series (Number and Letter Series) (Numerical Relations and Reasoning), Logical Sequence Of Words, Calendar, Clock, Cubes & Dices, Analytical Reasoning (Counting Figures Reasoning), Data Arrangement, Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning), Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning)
- Verbal Ability: Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions), Cloze Test (Cloze Passage), Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing), Vocabulary, Sentence Completion (Fill in the blanks), Active Passive Voice (Voice), Direct and Indirect Speech, Subject Verb Agreement (Verb Noun Agreement), Tenses, Preposition, Articles, Sentence Correction (Error Correction)
- Programming Basics (MCQs + Interview): C Programming by Yash Sir, Programming in C++, Java, Python for Placements by Yash Sir
- OOPs (MCQs + Interview): Object Oriented Programming (OOPS)
- DBMS (MCQs + Interview): Basics of DBMS, ER Diagram, Relational Model & Functional Dependencies, Keys & Integrity Constraints, Normalization (1NF - BCNF), Transaction Management, Decomposition Properties & 4NF, Concurrency Control, Database Recovery, File Organization & Indexing, Relational Algebra, Database Security & Authorization
- SQL (MCQs + Interview): SQL
- Operating Systems (MCQs + Interview): Introduction to OS, Process Management, CPU Scheduling, Deadlock, Threads & Process Creation, Memory Management, Virtual Memory, Process Synchronization, Disc Scheduling, File Management, Security
- Computer Networks (MCQs + Interview): Introduction to CN, Data Communication, DLL: Access Control, DLL: Flow Control, DLL: Error Control, DLL: Framing, Data Link Layer - Ethernet, Net Layer: IPv4 & Proto, Net Layer: IP Addressing, Net Layer:Routing Protocol, Transport Layer Services, TL: Congestion & UDP, Application Layer, Hardware basics, Network Security, Mobile Technology, Cloud Computing and IoT, Cyber and Info Security
- Coding: Coding Questions by Yash Sir
- HR Interview: MR & HR Interview Preparation
AI summary & chapters
AI Summary
An AI-generated summary of this video lecture.
This educational video provides a detailed lecture on the implementation of semaphores in operating systems, specifically focusing on the "Modified Wait" and "Modified Signal" operations designed to eliminate busy waiting. The instructor, Sanchit Jain, begins by introducing the topic and setting up a conceptual framework involving multiple processes. The core of the lesson transitions into a slide-based explanation of how to modify standard semaphore definitions. The lecture details the logic where a process executing a wait operation blocks itself rather than looping if the resource is unavailable. It further explains the corresponding signal operation that wakes up blocked processes. The instructor uses whiteboard diagrams to visualize the state of the semaphore value and the waiting queues, demonstrating how the value changes from positive to negative as processes wait and back towards zero as they are signaled. This approach ensures efficient CPU usage by preventing processes from consuming cycles while waiting for resources.
Chapters
0:00 – 2:00 00:00-02:00
The video opens with a title slide reading "Types of Semaphore" and identifying the instructor as "SANCHIT JAIN SIR" from "KNOWLEDGE GATE EDUCATOR". The lecturer begins drawing on a digital whiteboard to illustrate a scenario. He writes the labels P1, P2, P3 and draws a horizontal line, eventually labeling the end of the line P100. He performs a calculation on the board, writing 1/10 x 10 = 1, which appears to be a preliminary example or a setup for a probability problem related to the semaphore context. This initial segment sets the stage for discussing how processes interact with shared resources.
2:00 – 5:00 02:00-05:00
The presentation moves to a slide titled "Modified Wait". The text explains that to overcome busy waiting, the wait() operation is modified so that if the semaphore value is not greater than zero, the process blocks itself. The code snippet wait(semaphore *S) is displayed, showing the logic: S->value-- followed by an if statement checking if S->value < 0. If true, the process is added to S->list and block() is called. The instructor draws a diagram showing processes P1, P2, P3 queuing up. He writes S = -3 to indicate that three processes are currently waiting in the blocked state, illustrating the concept of a negative semaphore value representing the number of waiting processes.
5:00 – 7:39 05:00-07:39
The final section covers "Modified Signal". The slide text states that a blocked process should be restarted when another process executes a signal() operation. The code Signal(semaphore *S) is shown, which increments S->value++. If the new value is less than or equal to zero, a process P is removed from S->list and wakeup(P) is called. The instructor draws a diagram showing the semaphore value changing from S = -2 to -1 and finally to 0. He illustrates how processes P2, P3, P4 are removed from the waiting list and moved to the ready state, effectively demonstrating the mechanism of releasing resources and waking up waiting threads.
The lecture effectively bridges the gap between theoretical semaphore definitions and practical implementation by addressing the inefficiency of busy waiting. By modifying the wait and signal operations to include blocking and waking mechanisms, the system ensures that CPU time is not wasted on processes that cannot proceed. The visual progression from a simple calculation to complex queue management and state changes in the semaphore value provides a clear, step-by-step understanding of how operating systems manage concurrent access to shared resources. This method is crucial for maintaining system stability and performance in multi-threaded environments.