enum State { Waiting, Ready, isProcessing, Done } class Process { ArrivalTime: number; BurstTimeFirst: number; IOTime: number; BurstTimeSecond; CurrentState: State; constructor(ArrivalTime, BurstTimeFirst, IOTime, BurstTimeSecond) { if (ArrivalTime < 0 || BurstTimeFirst < 0 || IOTime < 0 || BurstTimeSecond < 0) throw new Error('Gia tri khoi tao phai lon hon khong'); this.ArrivalTime = ArrivalTime; this.BurstTimeFirst = BurstTimeFirst; this.BurstTimeSecond = BurstTimeSecond; this.IOTime = IOTime; this.CurrentState = ArrivalTime == 0 ? State.Ready : State.Waiting; } } class Scheduler { IOQueen: Array = []; ReadyQueen: Array = []; WaitingQueen: Array = []; CurrentProcess: Process; constructor(listProcess: Array) { for (const x of listProcess) { if (x.CurrentState == State.Waiting) this.WaitingQueen.unshift(x); else if (x.CurrentState == State.Ready) this.ReadyQueen.unshift(x); } this.WaitingQueen.sort((Process1, Process2) => Process1.ArrivalTime - Process2.ArrivalTime); console.log(this.WaitingQueen); } FSFS(): void { } } let Process1 = new Process(0, 5, 0, 0); let Process2 = new Process(1, 3, 0, 0); let Process3 = new Process(2, 1, 0, 0); let Process4 = new Process(3, 2, 0, 0); let list: Array = []; list.unshift(Process1); list.unshift(Process2); list.unshift(Process3); list.unshift(Process4); let sc = new Scheduler(list); sc.FSFS();