Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sched-rr: A round-robin scheduler for normal thread #129

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

sched-rr: A round-robin scheduler for normal thread #129

wants to merge 1 commit into from

Conversation

louisom
Copy link
Contributor

@louisom louisom commented Oct 10, 2016

This is a round-robin scheduler implement for normal thread (user-thread)
create by pager or pthread lib, and using timeslice, we can prevent user-space
thread starvation trigger by busy loop.

This scheduler only schedling user thread create by ipc "thread start protocal".

Default timeslice is 4096 ticks for now.

Other trivial change:

  • Update defconfing for all board
  • Add sched-rr into Makefile
  • Add new config in kernel/Kconfig for setting thread timeslice

This is a round-robin scheduler implement for normal thread (user-thread)
create by pager or pthread lib, and using timeslice, we can prevent user-space
thread starvation trigger by busy loop.

This scheduler only schedling user thread create by ipc "thread start protocal".

Default timeslice is 4096 ticks for now.

Other trivial change:
- Update defconfing for all board
- Add sched-rr into Makefile
- Add new config in kernel/Kconfig for setting thread timeslice
Copy link
Member

@jserv jserv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make rr as pluggable policy and refactor.

@@ -46,6 +46,7 @@ includes = \
board/$(BOARD) \
include \
include/platform \
include/sched-rr \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't name it after sched-rr. Instead, use include/sched and manipulate each scheduling policy through dedicated file.

@@ -93,6 +96,7 @@ loader-all-y += $(call objs_from_dir,kernel,loader-kernel)

dirs = \
kernel/lib \
kernel/sched-rr \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

@@ -16,6 +16,7 @@
#include <user-log.h>
#include <ktimer.h>
#include <interrupt.h>
#include <sched-rr/sched_rr.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto. It is not elegant!

#include <types.h>
#include <thread.h>
#include <ktimer.h>
#include <sched-rr/sched_rr.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

@@ -12,6 +12,7 @@
#include <platform/armv7m.h>
#include <fpage_impl.h>
#include <init_hook.h>
#include <sched-rr/sched_rr.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

@@ -411,6 +412,9 @@ static tcb_t *thread_select(tcb_t *parent)
if (thr == NULL)
return NULL;

if ((thr = rr_select()) != NULL)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make scheduling policy pluggable as Linux kernel does.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is like insmod/rmmod or config in make config?

Thanks.

Also, Linux kernel scheduler is pluggable!? Ain't they choose when config?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OMg is pluggable....since 2004!

https://lwn.net/Articles/109458/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant pluggable scheduler framework.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If rr_select returns NULL, thrwill be modified as NULL and unexpected result
will happen in the following code.

@@ -71,6 +71,10 @@ menu "Thread tweaks"
config INTR_THREAD_MAX
int "Maximum of interrupt threads"
default 256

config THREAD_TIME_SLICE
int "Maximum timeslice for threads"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improve the descriptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants