Threads ... ?
Posted: Fri Apr 11, 2008 7:27 am
Hello all,
I need to know what do I need to know to implement threads support for my OS in C or in ASM .
At this moment, malloc and free aren't implemented on my kernel, and I don't have a File System for my OS yet...
How to run two or more threads on the same time ? for example I want to run theses two threads : printf("Thread 1"); and printf("Thread 2"); .
Some links to very simple multi-tasking howto's would be nice .
The only thing I do understand yet is if there are two threads runing at the same time, the instructions sequence will be :
[1st instruction from Thread 1] Saving ESP, EIP ... and switching to Thread 2
[1st instruction from Thread 2] Saving ESP, EIP ... and switching to Thread 1
[2nd instruction from Thread 1] Saving ESP, EIP ... and switching to Thread 2
[2nd instruction from Thread 2] Saving ESP, EIP ... and switching to Thread 1
[3rd instruction from Thread 1] Saving ESP, EIP ... and switching to Thread 2
[3rd instruction from Thread 2] Saving ESP, EIP ... and switching to Thread 1
Thanks for help .
I need to know what do I need to know to implement threads support for my OS in C or in ASM .
At this moment, malloc and free aren't implemented on my kernel, and I don't have a File System for my OS yet...
How to run two or more threads on the same time ? for example I want to run theses two threads : printf("Thread 1"); and printf("Thread 2"); .
Some links to very simple multi-tasking howto's would be nice .
The only thing I do understand yet is if there are two threads runing at the same time, the instructions sequence will be :
[1st instruction from Thread 1] Saving ESP, EIP ... and switching to Thread 2
[1st instruction from Thread 2] Saving ESP, EIP ... and switching to Thread 1
[2nd instruction from Thread 1] Saving ESP, EIP ... and switching to Thread 2
[2nd instruction from Thread 2] Saving ESP, EIP ... and switching to Thread 1
[3rd instruction from Thread 1] Saving ESP, EIP ... and switching to Thread 2
[3rd instruction from Thread 2] Saving ESP, EIP ... and switching to Thread 1
Thanks for help .