npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

algorithmos

v1.0.9

Published

Các thuật toán của hệ điều hành

Downloads

15

Readme

AlgorithmOS

Các thuật toán về hệ điều hành Xem tài liệu tại: https://ambrosentk.github.io/AlgorithmOS/ NPM Package: https://www.npmjs.com/package/algorithmos

  1. Điều phối hỗn hợp CPU+IO: FCFS, SJF, SRTF, Round Robin
  2. *Lập lịch truy cập đĩa
  3. *Thay thế trang
  4. *Cấp phát bộ nhớ
npm i algorithmos

Process | Arrival time | CPU | IO | CPU --- | --- | --- | --- | --- | P1 | 0 | 3 | 4 | 3 P2 | 1 | 2 | 2 | 2 P2 | 2 | 1 | 1 | 5

import { Algorithm as al } from './Algorithms'

//Tạo hàng đợi các tiến trình theo yêu cầu

var taskQueue1 = new al.Queue<al.Task>();
taskQueue1.enQueue(new al.Task(al.TaskType.CPU, 3));
taskQueue1.enQueue(new al.Task(al.TaskType.IO, 4));
taskQueue1.enQueue(new al.Task(al.TaskType.CPU, 3));

var taskQueue2 = new al.Queue<al.Task>();
taskQueue2.enQueue(new al.Task(al.TaskType.CPU, 2));
taskQueue2.enQueue(new al.Task(al.TaskType.IO, 2));
taskQueue2.enQueue(new al.Task(al.TaskType.CPU, 2));

var taskQueue3 = new al.Queue<al.Task>();
taskQueue3.enQueue(new al.Task(al.TaskType.CPU, 1));
taskQueue3.enQueue(new al.Task(al.TaskType.IO, 1));
taskQueue3.enQueue(new al.Task(al.TaskType.CPU, 5));



//Tạo danh sách các tiến trình
var procList = new Array<al.Process>();
procList.push(new al.Process("P1", 0, taskQueue1));
procList.push(new al.Process("P2", 1, taskQueue2));
procList.push(new al.Process("P3", 2, taskQueue3));


//Chọn thuật toán điều phối
var scheduler = new al.SjfScheduler(procList);

//Chọn chế độ IO
scheduler.IOMode = al.IOType.Multi;

//Nhận kết quả trả về là một Storyboard
var story: al.Storyboard = scheduler.scheduling();

console.log(story.Story.length);

story.Story.forEach((value: al.StoryEvent, index: number, array: al.StoryEvent[]) => {
    console.log("Time: " + value.Time + "; Proc: " + value.ProcessName + "; Task: " + value.Description);
});

//In story ra màn hình
console.log();

Kết quả thực hiện thuật toán:

29
Time: 0; Proc: P1; Task: Arrived
Time: 1; Proc: P1; Task: CPU
Time: 1; Proc: P2; Task: Arrived
Time: 2; Proc: P1; Task: CPU
Time: 2; Proc: P3; Task: Arrived
Time: 3; Proc: P1; Task: CPU
Time: 4; Proc: P1; Task: IO
Time: 4; Proc: P3; Task: CPU
Time: 5; Proc: P1; Task: IO
Time: 5; Proc: P3; Task: IO
Time: 5; Proc: P2; Task: CPU
Time: 6; Proc: P1; Task: IO
Time: 6; Proc: P2; Task: CPU
Time: 7; Proc: P1; Task: IO
Time: 7; Proc: P2; Task: IO
Time: 7; Proc: P3; Task: CPU
Time: 8; Proc: P2; Task: IO
Time: 8; Proc: P3; Task: CPU
Time: 9; Proc: P3; Task: CPU
Time: 10; Proc: P3; Task: CPU
Time: 11; Proc: P3; Task: CPU
Time: 11; Proc: P3; Task: Terminated
Time: 12; Proc: P2; Task: CPU
Time: 13; Proc: P2; Task: CPU
Time: 13; Proc: P2; Task: Terminated
Time: 14; Proc: P1; Task: CPU
Time: 15; Proc: P1; Task: CPU
Time: 16; Proc: P1; Task: CPU
Time: 16; Proc: P1; Task: Terminated

Giải thích ý nghĩa: Mỗi một dòng là một sự kiện trong quá trình điều phối. Mỗi dòng có thời gian xảy ra sự kiện (Time), Tiến trình gây nên sự kiện (Proc), Tác vụ được làm trong sự kiện đó (Task).

Lưu ý: Thuật toán có thể bị sai trong một số trường hợp. Bạn nào có khả năng đóng góp, sửa lỗi thì chúng tôi chân thành cảm ơn.

Video hướng dẫn của giảng viên Phan Đình Thế Huân - ĐH Hoa Sen: Video Hướng dẫn

Tham khảo thêm trong tài liệu API