Skip to content

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.

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.


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.

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

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

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.

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.

3 participants