[Prev][Next][Index][Thread]

osenv_mem_alloc and stuff...



while reading the oskit.ps, the paper on OSKit 0.96, some things come to my attention, maybe I am ignorant, if so, please excuse me: blocking memory allocation --- isn't it enough to implement a lock acquire in the beginning of the code, so that if it is reentered, it will wait on the lock? or test if("lock acquired?" && non-blocking) return error, null (or whatever)? Isn't it better to have some sort of linked list, holding all the memory buffers allocated? Thus the OS will be able to ignore the OSENV_AUTO_SIZE flag and will disable the opportunity a buggy driver to report more or less memory than actually allocated? It may be hard to keep track of all the memory blocks (problems with allocation of memory for the linked list arise), but still this makes the OS less dependant on drivers' correctness.
    As to some questions, stated in the draft as to memory functions: osenv_mem_get_phys(...) -- better to supply the exact pointer of the memory block, since this will constitute a linear search of all the memory blocks, else the OS will have an overhead to calculate to which memory block this pointer belongs, even if the pointer was an exact start of a memory block (as returned from osenv_mem_alloc), there would be still an overhead...
    Interrupts: as I understand it, osenv_intr_disable() is called by a driver set, to "...disable further entry in the calling driver set through an interrupt handler..." Isn't it better, instead of disabling _all_ the interrupts (CLI or whatever), to disable the interrupt that the driver services by masking it in the PIC register (x86)? this way other drivers will go on working and since driver sets are by default disjoint, that is have nothing common, this won't affect other driver sets. (disabling interrupts can be done in a software level by rasing a flag that the interrput handler examines at its start...) i.e. just use a single/multiple calls to osenv_irq_disable(...) ?
    I'd be more than glad to get comments...
 
FtpDaemon