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

disapointing

parent 3daba6c2
......@@ -185,6 +185,7 @@ UPROGS=\
_zombie\
_getChildrenTest\
_getCountTest\
_OriginalSchedTest\
fs.img: mkfs 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
main(int argc,char **argv)
{
int a= fork();
fork();
fork();
fork();
wait();
wait();
wait();
......
......@@ -37,7 +37,7 @@ idtinit(void)
void
trap(struct trapframe *tf)
{
clockCounter();
if(tf->trapno == T_SYSCALL){
if(myproc()->killed)
exit();
......@@ -52,6 +52,7 @@ trap(struct trapframe *tf)
if(cpuid() == 0){
acquire(&tickslock);
ticks++;
clockCounter();
wakeup(&ticks);
release(&tickslock);
}
......@@ -105,8 +106,8 @@ trap(struct trapframe *tf)
// If interrupts were on while locks held, would need to check nlock.
currentQuantom++;
if(myproc() && myproc()->state == RUNNING &&
tf->trapno == T_IRQ0+IRQ_TIMER &&
(currentQuantom%QUANTUM==0 || cpuMode!= 1) )
tf->trapno == T_IRQ0+IRQ_TIMER /*&&
(currentQuantom%QUANTUM==0 || cpuMode!= 1)*/ )
yield();
// Check if the process has been killed since we yielded
......
struct stat;
struct rtcdate;
struct timeVariables;
struct timeVariables{//this struct for 3.4
int creationTime;
int terminationTime;
int sleepingTime;
int readyTime;
int runningTime;
};
// system calls
int fork(void);
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