Operating System Tutorial

Operating System Tutorial Types of Operating System Evolution of Operating System Functions of Operating System Operating System Properties Operating System Services Components of Operating System Needs of the Operating System

Operating Systems

Linux Operating System Unix Operating System Ubuntu Operating System Chrome Operating Systems Fedora Operating System MAC Operating System MS Windows Operating System Solaris Operating System Cooperative Operating System CorelDRAW Operating System CentOS FreeBSD Operating Systems Batch Operating System MS-DOS Operating System Commercial Mobile Operating Systems


Difference Between Multi-programming and Multitasking Difference between C-LOOK and C-SCAN Difference between Rotational Latency and Disk Assess Time Trap vs Interrupt Difference between C-SCAN and SSTF Difference between SCAN and FCFS Difference between Seek Time and Disk Access Time Difference between SSTF and LOOK Difference between Process and Program in the Operating System Difference between Protection and Security in Operating System

How To

How to implement Monitors using Semaphores How to Install a Different Operating System on a PC


What is Kernel and Types of Kernel What is DOS Operating System What is Thread and Types of Thread What is Process Scheduler and Process Queue What is Context Switching What is CPU Scheduling What is Producer-Consumer Problem What is Semaphore in Operating System Monitors in Operating System What is Deadlock What is Paging and Segmentation What is Demand Paging What is Virtual Memory What is a Long term Scheduler What is Page Replacement in Operating System What is BSR Mode What is Convoy Effect What is Job Sequencing in Operating System Why is it critical for the Scheduler to distinguish between I/O-bound and CPU-bound programs Why is there a Need for an Operating System


Process Management Process State Scheduling Algorithm FCFS (First-come-First-Serve) Scheduling SJF (Shortest Job First) Scheduling Round-Robin CPU Scheduling Priority Based Scheduling HRRN (Highest Response Ratio Next) Scheduling Process Synchronization Lock Variable Mechanism TSL Mechanism Turn Variable Mechanism Interested Variable Mechanism Deadlock Avoidance Strategies for Handling Deadlock Deadlock Prevention Deadlock Detection and Recovery Resource Allocation Graph Banker’s Algorithm in Operating System Fixed Partitioning and Dynamic Partitioning Partitioning Algorithms Disk Scheduling Algorithms FCFS and SSTF Disk Scheduling Algorithm SCAN and C-SCAN Disk Scheduling Algorithm Look and C-Look Disk Scheduling Algorithm File in Operating System File Access Methods in Operating System File Allocation Method Directory Structure in Operating System N-Step-SCAN Disk Scheduling Feedback Queue in Operating System Contiguous Memory Allocation in Operating System Real-time Operating System Starvation in Operating System Thrashing in Operating System 5 Goals of Operating System Advantages of Operating System Advantages of UNIX Operating System Bit Vector in Operating System Booting Process in Operating System Can a Computer Run Without the Operating System Dining Philosophers Problem in Operating System Free Space Management in Operating System Inter Process Communication in Operating System Swapping in Operating System Memory Management in Operating System Multiprogramming Operating System Multitasking Operating Systems Multi-user Operating Systems Non-Contiguous Memory Allocation in Operating System Page Table in Operating System Process Scheduling in Operating System Segmentation in Operating System Simple Structure in Operating System Single-User Operating System Two Phase Locking Protocol Advantages and Disadvantages of Operating System Arithmetic operations in binary number system Assemblers in the operating system Bakery Algorithm in Operating System Benefits of Ubuntu Operating System CPU Scheduling Criteria in Operating System Critical Section in Operating System Device Management in Operating System Linux Scheduler in Operating System Long Term Scheduler in Operating System Mutex in Operating System Operating System Failure Peterson's Solution in Operating System Privileged and Non-Privileged Instructions in Operating System Swapping in Operating System Types of Operating System Zombie and Orphan Process in Operating System 62-bit operating system Advantages and Disadvantages of Batch Operating System Boot Block and Bad Block in Operating System Contiguous and Non - Contiguous Memory Allocation in Operating System Control and Distribution Systems in Operations Management Control Program in Operating System Convergent Technologies in Operating System Convoy Effect in Operating System Copy Operating Systems to SSD Core Components of Operating System Core of UNIX Operating System Correct Value to return to the Operating System Corrupted Operating System Cos is Smart Card Operating System Cosmos Operating Systems Examples Generation of Operating System Hardware Solution in Operating System Process Control Block in Operating System Function of Kernel in Operating System Operating System Layers History of Debian Operating Systems Branches and Architecture of Debian Operating Systems Features and Packages of Debian Operating Systems Installation of Operating System on a New PC Organizational Structure and Development in Debian Operating Systems User Interface in Operating System Types Of Memory in OS Operating System in Nokia Multilevel Paging in OS Memory Mapping Techniques in OS Memory Layout of a Process in Operating System Hardware Protection in Operating System Functions of File Management in Operating System Core of Linux Operating System Cache Replacement Policy in Operating System Cache Line and Cache Size in Operating System

Logical Clock in Distributed System

Many machines collaborate in a distributed system; every machine could have a unique clock. However, these clocks might not be synchronized, meaning that no clock can be utilized to arrange occurrences in a worldwide order. A method to deal with this is to provide an appropriate date for each event using reasonable clocks. This allows events to be arranged logically and their relationship established, even if they occur on different machines. Logical clocks, in essence, provide a means of generating a virtual global wristwatch compatible with every machine in a distributed system.

By putting a set of rules in place on each machine in a distributed system, you can ensure that events are ordered consistently over an imaginary period. This is known as a logic clock. In a distributed system, a logical clock is a tool for recording causal and temporal linkages. Since a distributed system might not have a technically synchronized world clock, data from various processes in the system can be globally ordered using a logical clock.

Implementing Scalar Time

While many ways to create mathematical clocks in distributed frameworks exist, the scalar clock is one of the simplest ways. In this approach each process maintains a local clock which is originally set to 0. To update the current clock, there are two requirements:

Rule 1: Conduct of the Event

Add one to the global time before acting (apart from the act of getting a notification).

Local time + 1 equals local time.

Rule 2: Receiving Messages

Set your clock at the highest receiving clock number and receive the local time value whenever you get an email (the message must contain the sender's global clock value). Next, add one second to your local time.

max(local_clock, received_clock) = local_clock

local time + 1 equals local time.

This guarantees that all occurrences are arranged comparably, meaning that if event A causes another event, event A's timestamp will be later than event B's.


For example, consider a distributed system with three processes: P1, P2, and P3. However, if an event takes place in P1 and a message is also transmitted to P2, the communication will also contain the initial wristwatch value of P1. After receiving the notification, P2 will use Rule 2 to update its initial watch and ensure that the occurrences are correct.

Implementing Timestamps

Using dates and times is yet another method to build logical clocks. After every instance is given a timestamp, they are arranged in chronological order according to the causal relationship—that is, the "occurred before" relationship—between them. But timestamps are only useful if they follow the laws of causation.


For example, imagine we have a distributed system with multiple processes, and process P1 sends a message to process P2. If, however, the date and time of a message from P1 is smaller than the time of an earlier message from P2, then the reason connection fails, and the sequence of occurrences is not more coherent.

Distributed Systems Causality

Like a single PC system, determinism in a distributed system is still predicated on the happen-before link. To ensure cause and effect, even if event A happens in process P1 and event B happens in procedure P2, we must determine which happened first. Stated otherwise, we must ascertain the sequence of various systems' events.

Timings and Causation

Logical timepieces, which provide a date for every occurrence, can accomplish this. If event A leads to event B, the criterion remains the same; additionally, the date and hour for A must be less than the date for B.


For example, let us look at a distributed network where process P1 communicates with process P2. The timestamps for the downloading and accessing events in P1 and P2, respectively, are 1. We can conclude that there is an unproductive link between them because this shows that the transference event happened before the entry event.

Consequently, the explanation is vital in network logic clocks to preserve a sequence of occurrences and build a causal connection among them.


Logical clocks provide a means of preserving the consistent event sequence of a distributed system. A straightforward approach known as "scalar time" uses two principles and local clocks to guarantee proper ordering. Other techniques, such as timestamps, are also applicable but require causation to function correctly. Activities in a distributed system can cooperate in an organized, efficient manner through the use of logic clocks.