How we are arranging memory?
I know basic segment like
1. null segment
2. kernel code segment
3. kernel data segment
4. user code segment
5. user data segment
Now I want to know, each segment takes how much memory. just as example tell me.
and where we are putting stack segment.
In descriptor table we are only describing the above 5-segment. why not other segment.
Standard Memory segment Arrangement
Re: Standard Memory segment Arrangement
I use only three: one code segment of 4GiB and one data of 4GiB. I would turn the question back, why would you want a sixth? There's no point in adding more segments without any reason to do so.
- NickJohnson
- Member
- Posts: 1249
- Joined: Tue Mar 24, 2009 8:11 pm
- Location: Sunnyvale, California
Re: Standard Memory segment Arrangement
Most systems use a flat memory model, meaning all segments (except the null one, of course) have a base of 0 and a limit corresponding to the top of memory. That way, the only difference between the segments is their ring level. Paging is then used instead to do memory protection. If you're using segmentation for memory protection, the size of each segment really depends on what you're doing, although the kernel segments should be flat to give uniform access to memory, and you'll need more than one pair of user segments if you're going to be multitasking.
Also, the stack segment should be the same as the current data segment.
Edit: @skyking: you need to have separate kernel and user segments, otherwise you can't switch ring level, and therefore can't protect the kernel from user code.
Also, the stack segment should be the same as the current data segment.
Edit: @skyking: you need to have separate kernel and user segments, otherwise you can't switch ring level, and therefore can't protect the kernel from user code.
Re: Standard Memory segment Arrangement
So? I can still do multitasking, protection does not need to be a requirement.NickJohnson wrote: Edit: @skyking: you need to have separate kernel and user segments, otherwise you can't switch ring level, and therefore can't protect the kernel from user code.