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

Fix RR scheduler and mutex/cond #36

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

mlouielu
Copy link
Contributor

@mlouielu mlouielu commented Aug 24, 2017

This PR include three major fixed:

  1. Redesign RR scheduler to pass the test suite.
  2. Fix mutex, cond and pthread_mutex.
  3. Makefile can now switch scheduler via flags (make SCHED=RR)

@mlouielu mlouielu changed the title [WIP] Fix rr scheduler Fix RR scheduler and mutex/cond Aug 25, 2017
* mutex and cond should call `sched_dequeue` to remove
  `cur->ti_q` from its list when want to add `cur->ti_q`
  to another list.
* Change itt (thumb instruction) to normal instruction,
  due to the problem on QEMU.

## Makefile

You can switch scheduler by makefile flags:
Copy link
Member

Choose a reason for hiding this comment

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

We should make scheduler pluggable as Linux does instead of configuring it at build time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is possible to change scheduler in runtime using sched_select for now. But this is an easy step for running test and debugging.

kernel/sched.c Outdated
@@ -8,14 +8,18 @@ static const struct sched *sched;

int sched_select(int sched_type, struct thread_info *thread)
{
printk("Scheduler: ");
Copy link
Member

Choose a reason for hiding this comment

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

We don't need the invocation of printk in order to display scheduler internals literally. Instead, we can always deploy custom GDB script to perform deeper and effective tracing over existing framework.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I'll take a reference from f9-kernel, except gdb script, maybe some probe can be plugin.

{
if (thread)
Copy link
Member

Choose a reason for hiding this comment

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

Can we initialize without checking thread? That is, we can explicitly arrange the order.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why not check about thread is NULL or not (or maybe checking the type is struct thread_info), is there any benefit to put a NULL into runqueue?

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

2 participants