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.

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.

commented: Clarity is always a good answer. +7

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.

.

commented: Good answer, spiced with passion. +7

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..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.