Uniprocessor

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
matthias
Member
Member
Posts: 158
Joined: Fri Oct 22, 2004 11:00 pm
Location: Vlaardingen, Holland
Contact:

Uniprocessor

Post by matthias »

In a uni-processor environment do I need, mutexes, spinlocks, semaphores etc??
The source of my problems is in the source.
User avatar
carbonBased
Member
Member
Posts: 382
Joined: Sat Nov 20, 2004 12:00 am
Location: Wellesley, Ontario, Canada
Contact:

Post by carbonBased »

Spinlocks, no.

But if you're going to implement any form of multitasking you *will* need mutexes and semaphores (or an equivalent form of thread synchronization).

--Jeff
User avatar
matthias
Member
Member
Posts: 158
Joined: Fri Oct 22, 2004 11:00 pm
Location: Vlaardingen, Holland
Contact:

Post by matthias »

Hmm, I've looked over osdever.net to find some good tutorials about semaphores, mutexes, but didn't really find something about these. Does anyone know a good tutorial, with which I mean a tutorial that has proven itself. Yes I can google it, but if I don't know if it is good I will lose valuable time, because soon I will start studying informatics, so I don't wish losing time on tutorials which are not good. I will need time for my study ;)
The source of my problems is in the source.
User avatar
carbonBased
Member
Member
Posts: 382
Joined: Sat Nov 20, 2004 12:00 am
Location: Wellesley, Ontario, Canada
Contact:

Post by carbonBased »

There aren't many tutorials, that I've seen... I wrote my semaphores, mutexes and message queue's blindly. But they do work :)

I plan on writting a tutorial on these one of these days... maybe I'll write it fairly soon, as there appears to be a need for this sort of thing.

Effectively, you need to implement (potentially) new states to your task scheduler. You need a way to mark a task is waiting (ie, blocked on a mutex), and you need a way to bring that task back from waiting to ready once that mutex becomes available.

It would also be a good idea to create a function that, when called, voluntarily gives up control to another task (ie, allows a task to preempt itself, before its timeslice has elapsed).

If you'd like to look at some code, my latest OS contains all of these concepts and can be downloaded from www.neuraldk.org (look under software -> ndk ).

If you have any questions, feel free to post, and I'll see if I can explain, before I get this tut written.

--Jeff
User avatar
matthias
Member
Member
Posts: 158
Joined: Fri Oct 22, 2004 11:00 pm
Location: Vlaardingen, Holland
Contact:

Post by matthias »

Such a tutorial I would like :P But I'll look up your source, thanks mate :D
The source of my problems is in the source.
Post Reply