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 Aptitude: Number System, Percentage, Profit and Loss, Ratio and Proportion (Ratios), Average, Time and Work, Speed Time and Distance, Simple Interest and Compound Interest, Mixture and Alligation, Data Interpretation, Permutation and Combination, Probability, Logarithm, Powers and Exponents (Surds and Indices), Age Problems, Divisibility Rules, Partnership, HCF LCM, Algebra, Pipe and Cistern
- Logical Reasoning: Series (Number and Letter Series) (Numerical Relations and Reasoning), Analogy, Coding Decoding, Blood Relations, Directions (Direction Test), Syllogisms, Logical Sequence Of Words, Data Sufficiency, Seating Arrangements, Puzzle Solving (Puzzles), Calendar, Clock, Cubes & Dices, Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning), Data Arrangement
- English Language: Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions), Sentence Correction (Error Correction), Sentence Completion (Fill in the blanks), Vocabulary, Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing), Active Passive Voice (Voice), Direct and Indirect Speech, Cloze Test (Cloze Passage), Tenses, Subject Verb Agreement (Verb Noun Agreement), Preposition, Articles, Conjunction, Adverb
- Written English Test: English Writing Ability
- Coding: Coding Questions by Yash Sir, C Programming by Yash Sir, Programming in C++, Java, Python for Placements by Yash Sir
- Communication Round: Communication Assessment
- DBMS (Technical Interview): Basics of DBMS, ER Diagram, Relational Model & Functional Dependencies, Keys & Integrity Constraints, Normalization (1NF - BCNF), Decomposition Properties & 4NF, File Organization & Indexing, Relational Algebra, Relational Calculus, Transaction Management, Concurrency Control, Database Recovery, ORDBMS, Database Security & Authorization, Query Processing & Optimization, Enhanced Data Models, Big Data Systems, NoSQL, Data Warehousing & Mining
- SQL (Technical Interview): SQL
- Operating Systems (Technical Interview): Introduction to OS, Process Management, CPU Scheduling, Process Synchronization, Deadlock, Threads & Process Creation, Memory Management, Virtual Memory, Disc Scheduling, File Management, Windows OS, Linux OS, Security, Distributed Systems, Virtual Machines
- Computer Networks (Technical 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
- OOPs (Technical Interview): Object Oriented Programming (OOPS)
- 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.