abhijeets7663@gmail.com
help@ccatcracker.in

Paging :

Computer memory is divided into small partitions that are all the same size and referred to as, page frames. Then when a process is loaded it gets divided into pages which are the same size as those previous frames. The process pages are then loaded into the frames.

The main idea behind the paging is to divide each process in the form of pages. The main memory will also be divided in the form of frames.

Paging is a fixed size partitioning scheme.

In paging, secondary memory and main memory are divided into equal fixed size partitions.

The partitions of secondary memory are called as pages.

The partitions of main memory are called as frames.

Each process is divided into parts where size of each part is same as page size.

The size of the last part may be less than the page size.

The pages of process are stored in the frames of main memory depending upon their availability.


For implementing paging the physical and logical memory spaces are divided into the same fixed-sized blocks. These fixed-sized blocks of physical memory are called frames, and the fixed-sized blocks of logical memory are called pages.

When a process needs to be executed the process pages from logical memory space are loaded into the frames of physical memory address space. Now the address generated by CPU for accessing the frame is divided into two parts i.e. page number and page offset.

The page table uses page number as an index; each process has its separate page table that maps logical address to the physical address. The page table contains base address of the page stored in the frame of physical memory space. The base address defined by page table is combined with the page offset to define the frame number in physical memory where the page is stored.

Watch this video : https://youtu.be/xAvC-MJ_Sz8

Segmentation :

Computer memory is allocated in various sizes (segments) depending on the need for address space by the process. These segments may be individually protected or shared between processes. Commonly you will see what are called “Segmentation Faults” in programs, this is because the data that’s is about to be read or written is outside the permitted address space of that process.

Like Paging, Segmentation is also a memory management scheme. It supports the user’s view of the memory. The process is divided into the variable size segments and loaded to the logical memory address space.

The logical address space is the collection of variable size segments. Each segment has its name and length. For the execution, the segments from logical memory space are loaded to the physical memory space.

watch this video : https://youtu.be/E7XQesMS0bg

Difference between Paging and Segmentation :

1. The basic difference between paging and segmentation is that a page is always of fixed block size whereas, a segment is of variable size.

2. Paging may lead to internal fragmentation as the page is of fixed block size, but it may happen that the process does not acquire the entire block size which will generate the internal fragment in memory. The segmentation may lead to external fragmentation as the memory is filled with the variable sized blocks.

3. In paging the user only provides a single integer as the address which is divided by the hardware into a page number and Offset. On the other hands, in segmentation the user specifies the address in two quantities i.e. segment number and offset.

4. The size of the page is decided or specified by the hardware. On the other hands, the size of the segment is specified by the user.

5. In paging, the page table maps the logical address to the physical address, and it contains base address of each page stored in the frames of physical memory space. However, in segmentation, the segment table maps the logical address to the physical address, and it contains segment number and offset (segment limit).

Deadlock :

Deadlocks are a set of blocked processes each holding a resource and waiting to acquire a resource held by another process.

Watch Below videos :
1. https://youtu.be/_zOTMOubT1M
2. https://youtu.be/JABarkXjxpk
3. https://youtu.be/U7zKBXg-YOI
4. https://youtu.be/ok5jgFgUzrs

Above videos are more than enough to solve any Deadlock question in ccat exam .

How to avoid Deadlocks :

Deadlocks can be avoided by avoiding at least one of the four conditions, because all this four conditions are required simultaneously to cause deadlock.

1. Mutual Exclusion :
Resources shared such as read-only files do not lead to deadlocks but resources, such as printers and tape drives, requires exclusive access by a single process.

2. Hold and Wait :
In this condition processes must be prevented from holding one or more resources while simultaneously waiting for one or more others.

3. No Preemption :
Preemption of process resource allocations can avoid the condition of deadlocks, where ever possible.

4. Circular Wait :
Circular wait can be avoided if we number all resources, and require that processes request resources only in strictly increasing(or decreasing) order

How to Handle Deadlock :

Above informations for avoid deadlock but what if I want to handle deadlock ? :

Then use below methods :
1. Preemption :
We can take a resource from one process and give it to other. This will resolve the deadlock situation, but sometimes it does causes problems.

2. Rollback :
In situations where deadlock is a real possibility, the system can periodically make a record of the state of each process and when deadlock occurs, roll everything back to the last checkpoint, and restart, but allocating resources differently so that deadlock does not occur.

3. Kill one or more processes :
Very easy method but still it works .

Note : Please read theory very carefully if you didnt understand any concept search it on google because only theory based objective questions will come in exam .


Last-Day