Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> You cannot even buy a chip that implements segments

Not only can you buy a chip that implements segments, the computer you wrote that statement on probably has such a chip.



It is arm-based, so I believe it doesn’t. If you’re about x86s, then segment registers are there, but were not actually used (except for fs-gs utility cases) for almost a couple of decades, afaik. Segmented memory model is simply slow, cumbersome and unnecessary in the presence of decent pmmu.

Edit: though strictly speaking I was obviously wrong on that, clarifications are welcome.


While it may be “cumbersome” from the programmers perspective - it’s certainly a lot faster than an MMU.

There’s no universe where traversing a page table (actually a tree) in memory is faster than an offset and a bounds check.


What are you talking about? On x86 page tables were cached in TLB since their introduction. No mmu at all (80286) means that you're subject to fragmentation, and swapping segments is as expensive as a syscall since you have to lookup the descriptor through GDTR. x86 segments are scarce, expensive and cumbersome resources invented to cover bus width mismatch. Today it is not ever an issue. Even TSS is shared one per cpu, so much useless and slow its hardware part is.

We could imagine more segment registers and bigger descriptor tables, but that would be just poor man's manual TLB (manual always failed in cpus). If you concerned with constant checks, you may order yourself a cpu with BOUND instruction support and put it everywhere with the same result. Oh, it is already in x86-64, nevermind.

>actually a tree

It is 2 level "tree", afair. Directory and table. Please make your homework and research why segmented model was kicked off software arena by virtually everyone involved.


Spoken like a programmer that has never had to fix TLB misses as a bottleneck. It’s actually quite common as the TLB is rather small. Not even enough for 2MB worth of 4K pages.

You can use huge pages but it has all of the drawbacks of segments and none of the benefits.

VMWare used to have a super fast 32-bit hypervisor based on segments long before special instructions were added. This of course had to be reworked completely for X64.

Also Intel’s bound check instructions are still extremely rare and don’t work that well in practice. I’ve used them.


A recipe for fixing TLB misses (as any cache misses) is simple: don’t thrash your cache. Ofc I didn’t, I cannot even imagine what does one do to bottleneck at TLB – LSD? It is one of these problems like “doc, if I turn my finger 180, it hurts”.

>VMWare 32-bit before special instructions

DOS also was pretty fast, but that didn’t make it a good multi-user protected-mode OS. All these early emulations and monkey patching of guests cannot substitute hardware vt in the wild.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: