wisemonkeys logo
FeedNotificationProfileManage Forms
FeedNotificationSearchSign in
wisemonkeys logo

Blogs

Memory

profile
Deepti Ghori
Aug 14, 2024
0 Likes
0 Discussions
34 Reads

A user program can be subdivided using segmentation, in which the program and its associated data are divided into a number of segments . It is not required that all segments of all programs be of the same length, although there is a maximum segment length. As with paging, a logical address using segmentation consists of two parts, in this case a segment number and an offset.  


Because of the use of unequal-size segments, segmentation is similar to dynamic partitioning. In the absence of an overlay scheme or the use of virtual memory, it would be required that all of a program’s segments be loaded into memory for execution. The difference, compared to dynamic partitioning, is that with segmentation a program may occupy more than one partition, and these partitions need not be contiguous. Segmentation eliminates internal fragmentation but, like dynamic partitioning, it suffers from external fragmentation. However, because a process is broken up into a number of smaller pieces, the external fragmentation should be less.  


Whereas paging is invisible to the programmer, segmentation is usually visible and is provided as a convenience for organizing programs and data. Typically, the programmer or compiler will assign programs and data to different segments. For purposes of modular programming, the program or data may be further broken down into multiple segments. The principal inconvenience of this service is that the programmer must be aware of the maximum segment size limitation.  


Another consequence of unequal-size segments is that there is no simple relationship between logical addresses and physical addresses. Analogous to paging, a simple segmentation scheme would make use of a segment table for each process and a list of free blocks of main memory. Each segment table entry would have to give the starting address in main memory of the corresponding segment. The entry should also provide the length of the segment, to assure that invalid addresses are not used. When a process enters the Running state, the address of its segment table is loaded into a special register used by the memory management hardware. 


Consider an address of n + m bits, where the leftmost n bits are the segment number and the rightmost m bits are the offset. In our example, n = 4 and m = 12. Thus the maximum segment size is 2^12 =4096.

The following steps are needed for address translation: 

 • Extract the segment number as the leftmost n bits of the logical address. 

 • Use the segment number as an index into the process segment table to find the starting physical address of the segment. 

 • Compare the offset, expressed in the rightmost m bits, to the length of the segment. If the offset is greater than or equal to the length, the address is invalid.

• The desired physical address is the sum of the starting physical address of the segment plus the offset.  

In our example, we have the logical address 0001001011110000, which is  segment number 1, offset 752. Suppose that this segment is residing in main memory starting at physical address 0010000000100000. Then the physical address is 0010000000100000 + 001011110000 = 0010001100010000 ( Figure below ). 

To summarize, with simple segmentation, a process is divided into a number of segments that need not be of equal size. When a process is brought in, all of its segments are loaded into available regions of memory, and a segment table is set up.


Comments ()


Sign in

Read Next

MEMORY MANAGEMENT (techniques)

Blog banner

How Men and Women Process Pain Differently

Blog banner

Linux Threads:

Blog banner

Understanding Univariate, Bivariate, and Multivariate Analysis in Data Science

Blog banner

Expressing and Measuring Risk (Risk Management)

Blog banner

What's Better : Supervised or Unsupervised Learning

Blog banner

Thumb Sucking: When It’s Normal and When It Becomes a Dental Problem

Blog banner

The Role of Data Provenance and Lineage in Modern Data Science

Blog banner

Cross site scripting Attack

Blog banner

Bots and Cyber Security

Blog banner

Segmentation and paging concept

Blog banner

Mango Raisin Chutney (sweet mango raisin spread)

Blog banner

How Industrial Gratings Improve Safety, Drainage, and Workplace Efficiency?

Blog banner

How Paint Protection Film Protects Your Car From Scratches and Stone Chips

Blog banner

How To Implement Search Engine Marketing (Sem) Strategy Effectively

Blog banner

Deadlock and starvation in operating system

Blog banner

?What Your Dentist Notices The Moment You Sit In The Chair

Blog banner

Threads

Blog banner

How Unstructured Play Helps Children Become Creative Thinkers

Blog banner

Moral Injury Among Healthcare Workers: When Caring Conflicts With Conscience

Blog banner

Business-to-Business

Blog banner

File management

Blog banner

What is Internet

Blog banner

"The Benefits of Using GIS in Agriculture"

Blog banner

Data is an asset and it is your responsibility!

Blog banner

Confidence Building Activities for the New School Year

Blog banner

Zero-Day Attack

Blog banner

OPERATING SYSTEM

Blog banner

Discover The Top 3 Places To Stay in London

Blog banner

Routers

Blog banner

Virtual Memory

Blog banner

Why Travellers from Miami & Orlando Are Visiting Arcadia for Weekend Getaways?

Blog banner

K-means use cases

Blog banner

Gaming Disorder: When Gaming Affects Mental Health

Blog banner

Yoga in INDIA and ABROAD

Blog banner

Multicore and multithreading 171

Blog banner

"Life as a Part-time Student"

Blog banner

DNS Cache

Blog banner

Why Data Privacy Is Changing Online Advertising

Blog banner

You Get Everyone, But No One Gets You: The Lonely Side of High Emotional Intelligence

Blog banner

Music

Blog banner

Autonomy Vehicles: Future Ki Gadiya

Blog banner