Dear colleagues I am currently working on designing a scheduler using Borland C. I am struck with the concept of interrupts. I am trying clock tick interrupt for task switching. In all materials they say you will continue to your regular job until the interrupt occurs. I don't think it suddenly occurs with out setting it in the context of the task. this is my first project in C. currently my tasks don't have separate stack of their own. all share the same stack. so i will be happy if you people tell me in what way i should update my knowledge.
in my part i will help to you people too.

Here is one example of how to do it. I hope you are familiar with assembly language.

Thank u sir.. I had already gone through this link.. I dont have any doubt in the installation of interrupt what are all should be saved. I am confused with achieving the parallelism in C. that is preempting the task using interrupt with out task's cooperation.

Do you want a preemptive task scheduler, or non-preemptive? In either case you will need to set up stack segments for each of the tasks, then in the task-switcher function save the value of all registers onto the current stack, switch stacks, the restore all register values for the new task. AFAIK you can't do that in C language -- use assembly code.

Do you want a preemptive task scheduler, or non-preemptive? In either case you will need to set up stack segments for each of the tasks, then in the task-switcher function save the value of all registers onto the current stack, switch stacks, the restore all register values for the new task. AFAIK you can't do that in C language -- use assembly code.

It is a preemptive scheduler

You are asking about some pretty complex code, which I am not prepared to provide to you. Its been 15-20 years since I did worked with that. Your best bet would be to study some of these google links. At least one of them has some c source code, for what its worth.

Comments
Clarity is always a good answer.

Dear colleagues I am currently working on _________ using Borland C.

with all the solid professional compilers and dev environments out there -- many of them absolutely free -- why anyone, anywhere still uses this pile of non-standard crap of a compiler, is beyond me.

it truly hurts my soul.


EDIT: and as A.D. pointed out, this is exceedingly complex. using buggy, non-standard, unportable Borland, you are just asking for even more trouble.

.

Edited 7 Years Ago by jephthah: n/a

Comments
Good answer, spiced with passion.

You are asking about some pretty complex code, which I am not prepared to provide to you. Its been 15-20 years since I did worked with that. Your best bet would be to study some of these google links. At least one of them has some c source code, for what its worth.

Thank you Mr.Dragon for your reply. Really I am not asking for codes. As it is my first attempt on designing scheduler I just wanted the study thing which could give idea. Thanks sir..

This article has been dead for over six months. Start a new discussion instead.