Commit e5b82e38 authored by Amir Hosein Kashani's avatar Amir Hosein Kashani

disapointing

parent 3daba6c2
...@@ -185,6 +185,7 @@ UPROGS=\ ...@@ -185,6 +185,7 @@ UPROGS=\
_zombie\ _zombie\
_getChildrenTest\ _getChildrenTest\
_getCountTest\ _getCountTest\
_OriginalSchedTest\
fs.img: mkfs README $(UPROGS) fs.img: mkfs README $(UPROGS)
./mkfs fs.img README $(UPROGS) ./mkfs fs.img README $(UPROGS)
......
#include "types.h"
#include "stat.h"
#include "user.h"
//#include "proc.h"
int
main()
{
//struct timeVariables *t = malloc(sizeof(struct timeVariables));
for(int i=0;i<10;i++){
if(fork()!=0)
wait();
else
{ int f = getpid();
for(int j=0;j<1000;j++){
printf(1,"[%d]:[%d]\n",f,i);
}
break;
}
}
exit();
}
\ No newline at end of file
...@@ -5,9 +5,11 @@ int ...@@ -5,9 +5,11 @@ int
main(int argc,char **argv) main(int argc,char **argv)
{ {
int a= fork(); int a= fork();
fork(); fork();
fork(); fork();
fork(); fork();
wait(); wait();
wait(); wait();
wait(); wait();
......
...@@ -37,7 +37,7 @@ idtinit(void) ...@@ -37,7 +37,7 @@ idtinit(void)
void void
trap(struct trapframe *tf) trap(struct trapframe *tf)
{ {
clockCounter();
if(tf->trapno == T_SYSCALL){ if(tf->trapno == T_SYSCALL){
if(myproc()->killed) if(myproc()->killed)
exit(); exit();
...@@ -52,6 +52,7 @@ trap(struct trapframe *tf) ...@@ -52,6 +52,7 @@ trap(struct trapframe *tf)
if(cpuid() == 0){ if(cpuid() == 0){
acquire(&tickslock); acquire(&tickslock);
ticks++; ticks++;
clockCounter();
wakeup(&ticks); wakeup(&ticks);
release(&tickslock); release(&tickslock);
} }
...@@ -105,8 +106,8 @@ trap(struct trapframe *tf) ...@@ -105,8 +106,8 @@ trap(struct trapframe *tf)
// If interrupts were on while locks held, would need to check nlock. // If interrupts were on while locks held, would need to check nlock.
currentQuantom++; currentQuantom++;
if(myproc() && myproc()->state == RUNNING && if(myproc() && myproc()->state == RUNNING &&
tf->trapno == T_IRQ0+IRQ_TIMER && tf->trapno == T_IRQ0+IRQ_TIMER /*&&
(currentQuantom%QUANTUM==0 || cpuMode!= 1) ) (currentQuantom%QUANTUM==0 || cpuMode!= 1)*/ )
yield(); yield();
// Check if the process has been killed since we yielded // Check if the process has been killed since we yielded
......
struct stat; struct stat;
struct rtcdate; struct rtcdate;
struct timeVariables; struct timeVariables{//this struct for 3.4
int creationTime;
int terminationTime;
int sleepingTime;
int readyTime;
int runningTime;
};
// system calls // system calls
int fork(void); int fork(void);
int exit(void) __attribute__((noreturn)); int exit(void) __attribute__((noreturn));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment