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 What is Memory Mapping? Difference Between Network Operating System And Distributed Operating System What is the difference between a Hard link and a Soft Link? Principles of Preemptive Scheduling Process Scheduling Algorithms What is NOS? What is the Interrupt I/O Process? What is Time Sharing OS What is process termination? What is Time-Sharing Operating System What is Batch File File system manipulation What is Message-passing Technique in OS Logical Clock in Distributed System

Cache Line and Cache Size in Operating System

A cache line is a fundamental unit of memory, and its plays a crucial role in the performance of computer systems. Cache memory uses cache lines to store frequently accessed information and is also used to improve the performance of computer systems by reducing access time.

 Every cache line is mapped with its associated core line. A cache line is essential because they are used to minimize the power utilization of the system, and it is also used to store data in memory.

Cache memory is a high-speed memory, which is used to maintain the performance of the systems. It is a costly memory, and it is used to store data and instructions, so that CPU can quickly accesses them. When the CPU access data and instructions in the system, firstly, it checks the cache memory. If data and instructions are present in the cache memory, it quickly accesses without the help of the main memory. It minimizes the time needed to fetch the data, and if the information is not present in cache memory, then fetched data from the main memory, which requires more time.

Characteristics of Cache Lines

1- Size: Cache lines are typically fixed in size, but the size of the different cache lines depends on their architecture and some of the cache lines are 64 or 128 bytes.

2-Cache Tags: A tag is a unique identifier used to identify the locations of cache lines in the main memory. The tag is used to determine that if the cache line contains the data or instruction that the processor is looking for.

3-Associativity: Cache lines are arranged into different levels of Associativity as set-associative, direct-mapped, or fully associative. And this Associativity affects the number of cache lines stored in the memory.

4-Coherence: Coherence is one of the critical factors in a cache line, meaning that all processors must have a consistent view of the cache memory. And various coherence protocols are MOESI and MESI, which ensure that all processors have the correct information.

5- Placement: Cache line placement can be controlled to some extent through memory alignment techniques, which ensure that data items are stored at addresses that are multiples of the cache line sizes

Diagram Shows a Relationship between Cache line and Core line.

Cache Line and Cache Size

This relationship is shown between the cache line and the core line, and here, every cache line is mapped with its associated core line, and this core line is the corresponding region of backend storage. Both Cache storage and the backend storage are divided into many blocks of the size of a cache line, and all the cache mapping is aligned to these blocks. The cache line contains information on the Core id, Core line number, and valid bits for every sector

Cache Line Bouncing:

Cache line bouncing is a situation that occurs when multiple processors access the same cache line simultaneously, which can cause performance degradation and synchronization issues.

In such cases, it is essential to implement proper synchronization mechanisms to ensure that only one processor accesses the shared data at a time. Case line bouncing is used by various protocols such as MESI(Modified-Exclusive-Shared-Invalid) or MOESI(Modified-Owner-Shared-Invalid). These protocols ensure that all processors consistently view the cache memory.

Cache line bouncing characteristics:

1- Synchronization issues

2- Coherence

3- Increased Bus traffic

4- Performance degradation

5- Cache Invalidation.


Let's take two processors, P1 and P2; each has its cache, and they both are trying to access the exact memory locations; let's take address 0x1000.

Initially, both processors' caches contain the cache line for address 0x1000. Firstly, processor P1 reads the memory location and then updates its cache line. This causes the cache line in P2's cache to be invalidated. And then P2 also wants to read the memory locations at address 1x1000, which was just invalidated; P2 needs to retrieve the updated cache line from the main memory. And P2 fetches the cache line; it is stored in other cache lines. This means that P2's cache line is different from P1's cache line.

If P1 wants to update the memory location again, it must first fetch the updated cache line main memory since its cache line is no longer up-to-date. So this causes P2's cache line to be invalidated again, and then the process repeats.

Therefore, these phenomena of constant invalidation and replacement of cache lines are known as cache line bouncing, and this causes poor performance and increased bus traffic. To avoid cache line bouncing, processors can use protocols, such as MOESI and MESI, to ensure that cache lines are kept in sync between many processors.

Cache Size

Cache size refers to the amount of memory allocated to a cache. It is a fast memory on the processor's chip that stores frequently accessed data and information. The size of the cache is mainly measured in kilobytes or megabytes.

Cache size has a crucial impact on system performance; larger cache sizes typically have higher cache hit rates and lower cache misses, which can significantly improve the system's performance. Cache size also plays a vital role in computer system performance. A larger cache can reduce the number of cache misses and increase the cache hit rate, increasing system performance.

Features of Cache Size

Cache size is an essential factor in determining the performance of a computer system.

1- Limited size: Cache size and the physical space available on the processor chip are limited. As the size of a cache increases, it takes up more space on the chip.

2-Measurement: Cache size is typically measured in bytes like kilobytes (KB) or megabytes (MB).

3-Replacement Policy: Various replacement policies are used in Cache memory, such as least recently used (LRU) and random replacement.

4-Performance: A larger cache size significantly impacts system performance, and a larger cache can reduce the number of cache misses and increase the cache hit rate, which helps in faster system performance.

5-Levels: The cache is divided into various levels, and each level with a different size and access time.