chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] All threads are blocking by I/O


From: \\(--)/
Subject: Re: [Chicken-users] All threads are blocking by I/O
Date: Thu, 26 Sep 2013 01:52:02 +0400
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130801 Thunderbird/17.0.8

Hello,
think best way is using IO Completion Ports, cause WaitForMultipleObjects have limit on maximum wait objects (MAXIMUM_WAIT_OBJECTS=64 as i know) and also require maintain extra handle (CreateEvent) for each file descriptor.

I spent some time on research, what we have:

pros
no more hangs
no more fd_set, unlimited descriptor count
in theory increase web/file servers performance

cons
user should avoid direct access to file descriptors (port->fileno,file-select)
posix unit heavily use c library descriptors, better not touch this
small test auditory (maybe move this to pros, if we break something nobody will cry xD)
require changes in the chicken core, core dev team may not approve

More detail description.

require changes in scheduler,extras,library,ports

most significant:

*C_port_file
replace fopen with CreateFile(FILE_FLAG_OVERLAPPED)
associate file handle with the scheduler global completion port CreateIoCompletionPort(C_completion_port,file_handle)
return FILE* using "fdopen_osfhandle"

*stdin,stdout,strerr
reopen with OVERLAPPED attribute using "fdopen_osfhandle"

*C_read_char,C_write_char,C_display
replace calls to C_fprintf, C_fgetc with custom implementation
caller should wait unitl opeartion completed using ##sys#thread-block-for-i/o!

*scheduler
remove select&fd_set, maintain only fd <-> thread mappings.
declare C_completion_port global variable completion port handle
C_ready_fds_timeout receive ready descriptor via GetQueuedCompletionStatus(C_completion_port)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]