flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > good method of deciding process ID |
Author |
|
f0dder 08 Apr 2004, 11:45
Why not the index value into the system process table?
|
|||
08 Apr 2004, 11:45 |
|
david 09 Apr 2004, 16:27
Hi fodder!
Yes why not.. it seems simple and good. I could keep a counter that increments by one for each created thread/process, and use that as processID and hash into a hash-table with pointers to process structures. Eventually, after 0xFFFFFFFF created threads the counter will reset, but I don't think there's any risk my hobby-kernel will ever run that long (maybe if picky I could use a 64bit counter, but that seems overkill for now.. or perhaps 64bit pid where the top DWORD is the low 32bits returned from RDTSC when process was created, and the bottom DWORD is the value of the incrementing counter ~ that should be foolproof also I think) |
|||
09 Apr 2004, 16:27 |
|
f0dder 09 Apr 2004, 21:36
On overflow you could always wrap around and re-use old values - it's not very likely that you get 2^32 processes, and even less likely that they would all keep running
There are some things to consider, though... like "namespaces", should thread handles (for instance) be unique on the entire system, or only in a single process? What will you do for fast handle lookups (direct index values aren't all that good if you want to support a whole bunch of processes and threads, and searching a linked list linearly could also turn out to be slow). |
|||
09 Apr 2004, 21:36 |
|
david 10 Apr 2004, 02:49
Quote:
Right! Quote:
Mind-boggling! Namespaces, didn't even think of something like that yet, and neither do I know what this mean in the case of processes. Like, why would I wanna keep some processes only unique to a certain process, and not to the whole system? Please elaborate some more on that if you wanna, or put some link, I would appreciate it! But for fast handle lookups I wanna use a hash-table like I told previously, it is very fast. I would never use a linked list for that. I'm not by far doing theese kinda things yet, I'm still working with creating a priority scheduler for kernel threads that is working ok, but its still good to kinda plan ahead! thanks and have a good day |
|||
10 Apr 2004, 02:49 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.