Discussion:
Testing for different values of N and M
(too old to reply)
cs412017
2005-09-08 18:23:25 UTC
Permalink
Will our projects be tested for values of N and M other than 10 and 100?
When I set N to 100 (instead of 10), and run spawn.exe, the function
Spawn itself fails on the 12th thread (one of the functions Read_Fully,
Parse_ELF_Executable, or Load_User_Program fail), and returns -1, which
unfortunately, is what we are also returning from Sys_Spawn to indicate
that we've reached the maximum number of processes.

I was just wondering, will our projects be tested for values of N
greater than 10?

Thanks,
Arnab
Kwang Yul Seo
2005-09-09 01:40:54 UTC
Permalink
In currnet GeekOS implementation, you can't create more than 12
user threads.

There are only 16 GDT entries. Kernel threads and each user thread
consume these GDT entries. User thread frees its GDT entry when it
terminates. However, null.exe is an infinite loop and does not
terminate so it can't free its GDT entry.

Sys_Spawn need to get a GDT entry to spawn a thread and there is
no more GDT entry available, so it can't spawan. So even if you
increase N to 100, Sys_Spawn still returns -1 on the 12th call.

Kwang Yul Seo

Loading...