This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 2333333 | |
| 烤猫猫~ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| ### BEGIN INIT INFO | |
| # Provides: os-config | |
| # Required-Start: $local_fs $network $named $remote_fs | |
| # Required-Stop: | |
| # Should-Stop: | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: config of os-init job | |
| # Description: run the config phase without cloud-init |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Working |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| // Robin Round(Using limited time slice) Algorithm 时间片轮转调度算法(抢占式) | |
| let processes = [ | |
| ['P1', 10, 0], | |
| ['P2', 1, 1], | |
| ['P3', 5, 2], | |
| ['P4', 1, 3], | |
| ['P5', 2, 4] | |
| ], // [进程名,运行时间,到达输入井时间(从0ms开始)] | |
| readyQueue = [], // 就绪队列 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| // Preemptive Priority Scheduling (PSA Preemptive) Algorithm 抢占式优先级调度算法 | |
| let smallerValHigherPriority = true, // 小值优先级高(为false就是大值优先级高) | |
| processes = [ | |
| ['A', 10, 0, 5], | |
| ['B', 1, 1, 1], | |
| ['C', 5, 2, 3], | |
| ['D', 1, 3, 2], | |
| ['E', 2, 4, 4] | |
| ], // [进程名,运行时间,到达输入井时间(从0ms开始),指定的优先级] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| // Shortest Remaining Time First (SRTF) Algorithm 最短剩余时间优先调度算法(抢占式) | |
| let processes = [ | |
| ['P1', 10, 0], | |
| ['P2', 1, 1], | |
| ['P3', 5, 2], | |
| ['P4', 1, 3], | |
| ['P5', 2, 4] | |
| ], // [进程名,运行时间,到达输入井时间(从0ms开始)] | |
| readyQueue = [], // 就绪队列 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| // Highest Response Ratio Next (HRRN) 高响应比优先调度算法(非抢占式) | |
| let processes = [ | |
| ['P2', 30, 10], | |
| ['P1', 20, 0], | |
| ['P3', 25, 20], | |
| ['P4', 10, 30], | |
| ['P5', 15, 40] | |
| ], // [进程名,运行时间,到达输入井时间(从0ms开始)] | |
| readyQueue = [], // 就绪队列 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| // First Come First Serve(FCFS) 先来先服务调度算法(非抢占式) | |
| let processes = [ | |
| ['P2', 30, 10], | |
| ['P1', 20, 0], | |
| ['P3', 25, 20], | |
| ['P4', 10, 30], | |
| ['P5', 15, 40] | |
| ], // [进程名,运行时间,到达输入井时间(从0ms开始)] | |
| readyQueue = [], // 就绪队列 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| // PSA,优先级调度算法(非抢占式) | |
| let arr = [['A', 10, 3], ['B', 6, 5], ['C', 2, 2], ['D', 4, 1], ['E', 8, 4]], // [进程名,运行时间,优先级(数字越大越优先)] | |
| overall = 0; | |
| arr.sort((x, y) => y[2] - x[2]); | |
| for (let i = 0, len = arr.length; i < len; i++) { | |
| let item = arr[i], | |
| spend = item[1], | |
| sumBefore = 0; | |
| for (let j = 0; j < i; j++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| // Short Job First (SJF) 短进程优先调度算法(非抢占式) | |
| let processes = [ | |
| ['P1', 10, 0], | |
| ['P2', 1, 1], | |
| ['P3', 5, 2], | |
| ['P4', 1, 3], | |
| ['P5', 2, 4] | |
| ], // [进程名,运行时间,到达输入井时间(从0ms开始)] | |
| readyQueue = [], // 就绪队列 |
OlderNewer