Segmentation

RellixRellix Join Date: 2003-02-15 Member: 13572Members, Constellation, Reinforced - Shadow
<div class="IPBDescription">Help Rellix Study For His Evil Prelim</div> <!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->Segmentation and virtual memory

Segmentation, being based on the structure of a program, enhances the effects of locality of reference. It also allows processes to share code and data, and allows dynamic allocation of memory to processes that use dynamic data structures. A segment can be allowed to grow.

The overheads, though, are really quite elaborate. Each segment needs a descriptor which will contain the base address of the segment, its size limit, a bit to indicate whether it's in real memory or not, a segment used bit, and various protection bits (especially important if a segment contains data that might be accessed by more than one process).<!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd-->

Im studying for my pre-lim tomorw (fake exam used to appeal if my results suck on the real thing), and Im strugling to understand what exactly this is.

From my understanding its sorta like each program gets to share certain parts of memory if the code is similar.

Can anyone explain this better?

Comments

  • DOOManiacDOOManiac Worst. Critic. Ever. Join Date: 2002-04-17 Member: 462Members, NS1 Playtester
    What a coincidence, we just did Segmentation in my OS class last week. :P
    Note that this is for a Unix environment, so if you're studying Windows I can't gurantee it'll be the same. I wasn't there for Thursday's notes, but here is (most) of what I did Tuesday. Perhaps it'll help:

    <!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->Segments
    Memory layout of C program

    <b><u>Text Segment</u></b> - portion of RAM that contains machine instructions to be executed. Usually re-entrant (non self-modifying) and therefore, sharable. Usually set up with read-only access.

    <b><u>Initialized Data Segment</u></b> (aka Data Segment) - contains initialized variables that are storage class (external & static)

    When a program is loaded for execution, additional segments are added to the <u>address scope</u> of the program/process.

    <b><u>Uninitialized Data Segment</u></b> - contains variables of static & external data that were not initialized. The kernel initialized all bytes to 0 when memory is allocated.

    <u><b>Stack Segment</b></u> (automatic variables) - contains runtime stack. activation records are pushed onto the runtime stack upon entry to a block and they are popped upon exit from the block.

    <u>Activation record</u> - storage for formal arguments/parameters; storage for automatic variables; return value of the function; return address; size of the activation record

    <u><b>Heap Segment</b></u> - segment alloted for dynamic memory allocation. allowed to grow

    <u>address space</u> - space percieved to be available to process.<!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd-->

    Hope this helps.
  • HazeHaze O RLY? Join Date: 2003-07-07 Member: 18018Members, Constellation
    Ugh wish I could take notes on a computer in school. It'd be so much easier..
  • RellixRellix Join Date: 2003-02-15 Member: 13572Members, Constellation, Reinforced - Shadow
    So, it loads the segment into main memory specificly code that doesnt change and so can be used by other processes. When another process does need to change the code the original code is pushed to the stack until it is needed again.

    Im hoping this doesnt come up, or most of the stuff for that matter!

    But thanks for the help Doom I hope it comes in handy.
  • DOOManiacDOOManiac Worst. Critic. Ever. Join Date: 2002-04-17 Member: 462Members, NS1 Playtester
    in a language like C the process doesn't change code (non-mutable). It can w/ languages like PROLOG, but those are pretty rare and I can't imagine you'd be studying that in an os class...
  • RellixRellix Join Date: 2003-02-15 Member: 13572Members, Constellation, Reinforced - Shadow
    edited February 2005
    Its advanced higher computing which is really a first year univercity course cramed into one little nice book that gives me more headaches than days of the week.

    Its part of the Operating Systems topic but it gives too much detail for soem things i dont need to know and not even mention stuff ill need to know for the exam. Fortunatly this is the last year of this course running with these exact topics so they wont make new questions up so i just look at the lasst few years exams papers and its a pretty good chance theyl come up. Still the original quote was ALL it said about segmentation leaving the mind to work out what it actualy means.

    But as long as i can get part of the marks im happy:

    Is it me or does this seem almost the exact same conecept as paging?


    EDIT:
    Just back from the exam, fortunatly this didnt come up, or at least i donth think it did. I was aiming for 45 to 50% but from how i think it when its probably clsoer to 60-70%.
Sign In or Register to comment.