Skip to content

Use linked list in RRScheduler#5

Merged
equation314 merged 2 commits into
arceos-org:mainfrom
Starry-OS:r4l
Dec 13, 2025
Merged

Use linked list in RRScheduler#5
equation314 merged 2 commits into
arceos-org:mainfrom
Starry-OS:r4l

Conversation

@Mivik

@Mivik Mivik commented Nov 22, 2025

Copy link
Copy Markdown
Contributor

Description

The current round-robin scheduler uses a VecDeque to store ready tasks, which is inefficient because all required operations can be performed in constant time using a linked list. This PR replaces VecDeque with linked_list_r4l::List, thereby enhancing the scheduler's theoretical performance.

Backward compatibility

The public interface remains unchanged.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR optimizes the Round-Robin scheduler by replacing VecDeque with an intrusive linked list (linked_list_r4l::List), improving theoretical performance from O(n) to O(1) for task removal operations. The implementation follows the same pattern used by FifoScheduler in the codebase.

Key Changes

  • Added intrusive linked list support to RRTask by introducing a links field and implementing the GetLinks trait
  • Replaced VecDeque with linked_list_r4l::List in RRScheduler's ready queue
  • Simplified remove_task implementation from O(n) iteration to O(1) linked list removal

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@AsakuraMizu

Copy link
Copy Markdown

You may provide a benchmark result for old VecDeque, intrusive-collections and this one.

@equation314 equation314 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please wait for arceos-org/linked_list_r4l#5 to be merged.

@AsakuraMizu

Copy link
Copy Markdown

ping @Mivik

@AsakuraMizu

Copy link
Copy Markdown

Perhaps we should release linked_list_r4l version 0.3.0 (maybe?) first.

@Mivik

Mivik commented Nov 28, 2025

Copy link
Copy Markdown
Contributor Author

Yes, a version bump of linked_list_r4l is desired @equation314

@AsakuraMizu

Copy link
Copy Markdown

@Mivik linked_list_r4l 0.3.0 is released now.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@equation314 equation314 merged commit 4d86c55 into arceos-org:main Dec 13, 2025
11 checks passed
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.

5 participants