Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • O OSKernel2024-FlounderOS
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Terraform modules
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • 比目鱼OS物语
  • OSKernel2024-FlounderOS
  • Merge requests
  • !2

Implement Priority-Based Scheduling in Scheduler

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged 比目鱼OS物语 requested to merge dev into main Dec 18, 2024
  • Overview 0
  • Commits 1
  • Pipelines 0
  • Changes 2

Commit Title: Implement Priority-Based Scheduling in Scheduler

Commit Body:

  • Add priority Field:

    • Introduced a new int priority; field in the struct proc within proc.h to store the priority of each process.
  • Initialize Process Priority:

    • Updated the procinit() function in proc.c to set a default priority (p->priority = 10;) for each process during initialization.
  • Modify Scheduler for Priority Scheduling:

    • Enhanced the scheduler() function in proc.c to implement priority-based scheduling.
    • Traverses the process table to identify the runnable process with the highest priority.
    • Ensures that the highest priority process is selected for execution by comparing the priority fields.
  • Improve Lock Management:

    • Adjusted lock acquisition and release logic to prevent deadlocks and ensure proper synchronization.
    • Ensured that locks on previously selected highest priority processes are released before selecting a new one.
    • Added comments to clarify the rationale behind lock handling during the scheduling process.
  • Ensure System Stability:

    • Verified that the scheduler correctly handles cases where no runnable processes are available by entering a low-power state (wfi) without holding any locks.
    • Maintained consistency in c->proc to accurately reflect the currently running process.

Summary: This commit enhances the process scheduler by introducing a priority-based scheduling algorithm. By adding a priority field to each process and modifying the scheduler to select the highest priority runnable process, the system can achieve better responsiveness and resource management. Additionally, improvements in lock management ensure that the scheduler operates reliably without introducing concurrency issues.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: dev