<div dir="auto">The ability to mound virtual threads on a specific thread pool(/executor) is quite useful in general.<div dir="auto"><br></div><div dir="auto">Practically all applications with UI will want a designated thread pool for UI Vs the rest.</div><div dir="auto"><br></div><div dir="auto">CPU heavy applications may want to use OS threads for most of the application, but have 1/2 threads on the side to handle e.g. incoming request, put them in a queue for the CPU heavy process, and wait for it to finish before sending it onwards/returning a status.</div><div dir="auto"><br></div><div dir="auto">In these cases the ability to use virtual threads on the part of the application that it fits without interfering the other parts is currently impossible.</div><div dir="auto"><br></div><div dir="auto">As for the thread-per-core case, I don't see an immediate reason not to use virtual threads over e.g. event loop, but I will admit that the low level stuff is my weaker side</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jun 17, 2023, 14:12 Attila Kelemen <<a href="mailto:attila.kelemen85@gmail.com" target="_blank" rel="noreferrer">attila.kelemen85@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I'm not sure where you want to improve performance. Suppose we could create multiple virtual thread groups (each with an arbitrary number of carrier threads specified at group creation time). Assuming you have N cores, you could create N such groups with a single carrier thread each (then you somehow pin that carrier thread to a given core). Now you could execute virtual threads on a given core, but then you seem to lose most of the advantages, because virtual threads (even if they are running on the same core) are concurrent, so you can't really avoid synchronization at this point. Not to mention that you will get the overhead of virtual thread scheduling. I think if you really want some very low level optimization, then you probably have to use platform threads instead of virtual threads, and then write your tightly optimized code there.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Andrii Lomakin <<a href="mailto:lomakin.andrey@gmail.com" rel="noreferrer noreferrer" target="_blank">lomakin.andrey@gmail.com</a>> ezt írta (időpont: 2023. jún. 17., Szo, 11:29):<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Yes, that is what I intended to say. <div>I apologize for any confusion. Is there a plan to incorporate this feature in the future?<br></div></div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><br></div></div></div></div>
</blockquote></div></div>
</blockquote></div>