Browse thread
[Caml-list] Bug? Printf, %X and negative numbers
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Brian Hurt <brian.hurt@q...> |
| Subject: | Re: [Caml-list] Bug? Printf, %X and negative numbers |
On Tue, 1 Apr 2003, Ville-Pertti Keinonen wrote: > > > For structures 32 words or less, you can do it like (using x86 assembly > > language here): > > ...actual code snipped... > > Ok, that's not necessarily too bad. > > I guess I was just intuitively dismissing anything that felt like it > had more than a couple of instructions of "overhead". I'm probably > also biased by SMP-thinking - read-modify-write operations feel > inherently evil. ;-) > For SMP you want different minor heaps for every thread. Adding the lock prefix to an instruction costs ~100 clock cycles. Much better to simply give each thread it's own minor heap. 64K isn't that much memory. And there are stunts you can pull if you threads spend most of their life blocked to decrease the number of minor heaps you need. Note that you implicitly have a read-modify-write cycle already in your allocation. You need to read the top-of-heap pointer, save off the original pointer, increment by the size you are allocating, and write the incremented pointer back, all automatically. A wonderful application of load locked/store conditional, if only we had it in the x86. Without it, you basically need to grab a spinlock before updating. Thus the lock prefix. Brian ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners