user mode threads.

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

user mode threads.

Postby Julio Jerez » Thu Aug 16, 2018 12:02 pm

ok my experiment of combining jobs by implementing a sync function that spin the prosessor until the other threads catch a sync point, did made the code in general faster, but very unstable.
in the 2001 pile of bodies the parallel solver when from about 20 million clocks, to about 9 millions,
but is was a black art, setting more thread made goes to hundred of millions clocks.
that was not all, second guessing semaphores or muted is a doing at your own risk thing, at least in windows, because if you get all you core on a spin, and it happens that other processes call a high priority tread, then you get into a spin lock the can never get out.

to solve this problem semaphores has this thing called priority inversion, which make the spin a much higher priority while spinning in order to get a reply from the scheduler, else you will never get one if the is or other cores are running threads of higher than yours.
This made a no, no to implemented a sync function without semaphore.

I am not going to deal with priority inversion BS there I abandoned that aproach.

it still remind the high cost of task switching. so I was researching how other people has dealt with this problem. sure there has to be a solution, it does not make sense that running multiple thread can potentially make your app slower.

many people talk about Intel treading block template library, guess what in their docs, they say that a task switch can bet upto one million clock cycle, thats far worse than what I measured which is up to 256, round.

anyway it seems in windows 10, 64bit mode there a way to make thread very lightweighty by calling a function the enter user mode scheduler, which apparently put the responsibility on the app,
I just found that and has not read much.

does anyone has experience with this?
Julio Jerez
Moderator
Moderator
 
Posts: 11048
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: user mode threads.

Postby Julio Jerez » Thu Aug 16, 2018 1:22 pm

here is the article:
https://docs.microsoft.com/en-us/window ... scheduling

this is what the say:
UMS is recommended for applications with high performance requirements that need to efficiently run many threads concurrently on multiprocessor or multicore systems. To take advantage of UMS, an application must implement a scheduler component that manages the application's UMS threads and determines when they should run. Developers should consider whether their application performance requirements justify the work involved in developing such a component. Applications with moderate performance requirements might be better served by allowing the system scheduler to schedule their threads.


I guess MS is giving PC programmer the same ability the provide to console programmers for years.
Any way I have to reading to do. and I hope this is a solution to the high cost of multitasking.

here is an explanation from the horses mouse.
https://channel9.msdn.com/Shows/Going+D ... eduler-UMS
Julio Jerez
Moderator
Moderator
 
Posts: 11048
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: user mode threads.

Postby MeltingPlastic » Thu Aug 16, 2018 10:05 pm

This is interesting to know - I watched the video.
MeltingPlastic
 
Posts: 221
Joined: Fri Feb 07, 2014 11:30 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 5 guests