
Now I want to improve it and make it more advanced, but I have a lot of questions mostly due to most being OS implementation specific:
I am mostly edging to how Linux does things but I am open to better algorithms.
1 - Pretty much everywhere you read, the amount of time something runs in a CPU is determined on the process level, however what about the threads? Does the process get an assigned time-slice which is then shared across all of its threads? Or are all threads treated as separate and assigned different time slices.
2 - In my scenario, I am using the PIT to preempt a thread and keep a rough track of time; however would it be a better approach (assuming thread time-slices are calculated separately from the process) to configure the PIT to give the thread x amount of processing time OR would it be better to keep a standard PIT frequency (e.g. 1ms) and when the PIT timer preempts, do some tiny processing and check if the time slice has ran out of time and if not, go straight back to the process.
I still have a lot to learn and would love if someone could answer these questions since this is the best forum for them. Thank you!