8/6/2023 0 Comments Java timeslice windowsThere are a number of ways to improve things. and if not ,it it possible to adjust the time slice allocated per cpu or better yet per thread? That way the thread that pulls data from the buffer will be given a shorter time slice that the processing threads, yet with the same priority it won't delay in reading those updates?Īny suggestions is appreciated. Is it possible to allocate a specific thread to a specific core in Windows? That way a CPU won't be wasting cycles before switching context. the COP thread is always finding things to do from the update buffer and tends to read those updates too late now. So I tried giving that COP thread a lower priority than the processing threads but in that case I have noticed that now it seems to be behind, i.e. I was able to log that the COP thread most of time was doing nothing but pulling the update buffer. What I have been speculating it that maybe the COP thread, which is always active since it continuously reads from the update buffer, pausing with a Sleep(1) statement between cycles, once it gets the CPU attention (because it may run in the same processor/core running also one processing thread) is given the full CPU time slice which I believe is 10 or 20 ms, before the processing thread is given that CPU attention. What I have noticed is that there is almost systematically a 20+ miliseconds delay between the time the COP thread reads something from the update buffer and signals one available processing thread and the time the processing thread starts working on that update. So one COP thread that reads and a pool of threads that the COP thread signals to process updates. Then we have a number of identical (same code) threads that the COP Thread awakens by using a setevent call when something needs to be processed. Let's call the reading thread the COP Thread. The basic layout is that we have one reading thread that pulls updates from a buffer onto which updates are being put by a datafeed thread. I have a built a trading application that is multi threaded and I'm trying to optimize it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |