k0Iry / xv6-jos-i386-lab

All Labs implementation of 6.828 2018 OS course of MIT.
15 stars 5 forks source link

Optimize code for disk interrupt driver #13

Open k0Iry opened 4 years ago

k0Iry commented 4 years ago

Currently I handle the disk operation totally in kernel mode, is it possible to let user space do the handlings?

We passed quite a lot parameters in system calls, can we minimize the work for our code?

k0Iry commented 4 years ago

We only care about the moment between we issue the disk command(read/write), which are:

outb(0x1f7, 0xc4) // read
outb(0x1f7, 0xc5) // write
outsl(0x1f0, data, nescs) // now we are writing...

and the disk IRQ comes, there might be a timer IRQ happens, which will switch file env into ENV_RUNNABLE, then before file env being scheduled again by the scheduler, the disk IRQ comes, when we have to handle this event, then file env is scheduled and running, going to sleep after finished with disk IRQ handling!

So we either disable timer IRQs during this time, or come up with a better idea of putting env into sleeping?