Skip to content

Commit

Permalink
Merge pull request #9 from LucasAzoli/Dely-update
Browse files Browse the repository at this point in the history
Dely update
  • Loading branch information
LucasAzoli authored Nov 27, 2023
2 parents ae76576 + 86e1cf2 commit aff7b77
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# simulador-so
# simulador-so

Link Projeto https://lucasazoli.github.io/simulador-so/
15 changes: 2 additions & 13 deletions scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ class Escalonator{
o tempo executando + o tempo em espera), somamos na variável AverageResponseTime e
depois dividimos pelo número de processos, para calcular o tempo médio de execução.
*/
console.log(ProcessesByTime)
var ART = 0
for(let i = 0; i < this.ProcessArray.length; i++){
ART += this.ProcessArray[i].Finish - this.ProcessArray[i].Arrival
Expand Down Expand Up @@ -220,7 +219,6 @@ class Escalonator{
*/
if(RunningProcess == undefined && WaitingProcess.length == 0){
ProcessesByTime.push("N")
console.log("N")
Time++;
continue;
}
Expand All @@ -238,10 +236,7 @@ class Escalonator{
}
}
RunningProcess = WaitingProcess[NextProcess];
console.log("hey:\n")
console.log(WaitingProcess)
WaitingProcess.splice(NextProcess,1);
console.log(WaitingProcess)
}

/*
Expand All @@ -250,7 +245,6 @@ class Escalonator{
processo daqueles que estão aguardando.
*/
if(RunningProcess.ExecutionTime == RunningProcess.RunningTime){
console.log(`Processo ${RunningProcess.Key} acabou em ${Time-1}\n`)

RunningProcess.Finish = Time;
RunningProcess.Executed = true;
Expand All @@ -271,7 +265,6 @@ class Escalonator{
RunningProcess = WaitingProcess[NextProcess];
WaitingProcess.splice(NextProcess,1);
}
console.log(`Processo ${RunningProcess.Key} executando\n`)
ProcessesByTime.push(RunningProcess.Key)
RunningProcess.RunningTime++;
Time++;
Expand All @@ -283,7 +276,6 @@ class Escalonator{
o tempo executando + o tempo em espera), somamos na variável AverageResponseTime e
depois dividimos pelo número de processos, para calcular o tempo médio de execução.
*/
console.log(ProcessesByTime)
var ART = 0
for(let i = 0; i < this.ProcessArray.length; i++){
ART += this.ProcessArray[i].Finish - this.ProcessArray[i].Arrival
Expand Down Expand Up @@ -421,7 +413,6 @@ class Escalonator{
}
ART = ART / NumberOfProcess
this.AverageResponseTime = ART.toFixed(2)
console.log(ProcessesByTime)
ProcessesByTime.pop()
return ProcessesByTime
}
Expand Down Expand Up @@ -583,7 +574,6 @@ class Escalonator{
Time++;
}
var ART = 0
console.log(ProcessesByTime)
for(let i = 0; i < this.ProcessArray.length; i++){
ART += this.ProcessArray[i].Finish - this.ProcessArray[i].Arrival
}
Expand Down Expand Up @@ -649,7 +639,7 @@ class Memory {
this.memsize = 50;
this.memory = new Array(50).fill("-");
this.algorithm = algorithm; // consider this to be a string ("FIFO" or "LRU")
this.free = this.memsize; // free space in memory
this.free = 50; // free space in memory
this.active = new Queue(); // active processes in memory
this.LRU = new Queue(); // least recently used processes in memory
this.virtual = new Array(100).fill("-"); // virtual memory
Expand Down Expand Up @@ -710,14 +700,14 @@ class Memory {

for(let i = 0; i < this.memsize; i++) {
if(process.size() == aux){
this.free -= process.size();
break;
}
if(this.memory[i] == "-") {
this.memory[i] = process.Key;
aux++;
}
}
this.free -= process.size();

// update the virtual memory with the first occurence of the allocated process

Expand Down Expand Up @@ -1008,7 +998,6 @@ function updateMemory() {

let disco = document.getElementById("disco");
let discoArray = memory.virtual;
console.log(discoArray)
let discoHTML = '';

ramArray.forEach((obj, id) => {
Expand Down

0 comments on commit aff7b77

Please sign in to comment.