Thread: co operative scheduler design

  1. #1
    Registered User
    Join Date
    May 2017
    Posts
    128

    co operative scheduler design

    Hi
    I write code for microcontroller I want to write my own scheduler for microcontroller. But I am not getting any idea even after searching a lot

    scheduling is process by which operating system decide which one task will be next on processor



    keep in mind I am not asking code I am looking someone who can help me to design tiny co operative scheduler

    What kind of things do we put in scheduler in context of programming

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    38,629
    No idea what you were searching for, but there's plenty to be found.

    An introduction to schedulers:Co-operative and pre-emptive scheduling ~ 8051 microcontrollers
    7 steps to writing a simple cooperative scheduler

    > scheduling is process by which operating system decide which one task will be next on processor
    That's the thing about co-operative, the OS doesn't decide.

    If a task decides to not co-operate, there's nothing the OS can do.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Apr 2021
    Posts
    34
    I think the first thing to do would be to figure out how context switching is going to work.

    Write yourself a set of functions that do the absolute minimum scheduling: round-robin.

    - Tasks are added to the end of a list through some interface. (task_add(function-pointer))
    - Tasks execute until they voluntarily call "next_task()" or some such.
    - Tasks can remove themselves from the list through some interface. (task_exit() or something)
    - When "next_task()" is called, your code has to save the registers, save the stack, look up the next task in the list, set up the new stack, set up the registers, and return control to the new task.

    That code isn't going to change much if you decide to go in a different direction with your scheduling algorithm (priorities, real-time, interrupt service, etc.)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C Process Scheduler
    By cdhishna in forum C Programming
    Replies: 1
    Last Post: 04-05-2013, 11:39 AM
  2. brainstorming with a scheduler.
    By seemaxie in forum C Programming
    Replies: 2
    Last Post: 12-05-2012, 10:36 AM
  3. problem with the scheduler
    By ushacy in forum C Programming
    Replies: 3
    Last Post: 09-20-2011, 05:52 AM
  4. scheduler in linux
    By anjana in forum Linux Programming
    Replies: 6
    Last Post: 05-29-2007, 12:59 AM
  5. new scheduler in linux
    By anjana in forum Linux Programming
    Replies: 1
    Last Post: 05-28-2007, 02:55 AM

Tags for this Thread