Home > Net >  Would like to ask the question in respect to multithreading
Would like to ask the question in respect to multithreading

Time:11-28

Suppose you have an 8 16 thread CPU core

1. The multi-core CPU core, at the time of calculation is based on a core 2 threads, or 16 threads directly calculate?
2. If it is one core two threads, so want to take advantage of multithreaded only need to open a thread? Multi-threading CPU is a little less so? We'll need to open a process to play other core thread? So I think this is wrong, need bosses refers to the way?
3. If in fact calculation has always been a thread instead of the core, if 16 threads execute together, just want to take advantage of multithreaded only theoretically need to open 15 thread? So it can always use 16 threads? I calculate and open a thread, it is to wait for a spare CPU thread



CodePudding user response:

And round does not explain, and you just want to say the CPU parallel

We don't want to explain, "c # Paralle" baidu "c # thread pool thread scheduling," Windows isn't what you said the thread open thread, his own schedule, and round don't, don't you talk 1 w a thread, we want to high 5000 kcpu run?

CodePudding user response:

How to run a system is the thing, it is not you

You have to do is tell the system, I need to schedule a task, probably by what rules need to allocate (arrangement as soon as possible/I don't worry I can slowly), how high priority, use what the scheduler to schedule, this will do,

Other things let the system arrangement to you, after all, you are writing the application, not write the operating system

CodePudding user response:

Multicore multi-threading, at the time of calculation, it should be only one thread in the calculation, it can only handle A calculation at the same time, only the computer speed is too fast, it will be A computing three milliseconds, B processing three milliseconds, cycle time is not sure, seems to have A call turn time segments,
So want to take advantage of multithreaded only need to open a thread? Multi-threaded concurrent is the advantage of, is to do two thing at the same time, it would be a bit faster, than the single thread a bit faster, but not the more the better, because the thread when switching seems to have consumption, efficiency is not 1 + 1=2

CodePudding user response:

Even 2 nuclear, you open the 100 threads are ok, these are the two concepts

CodePudding user response:

reference 1st floor wanghui0380 response:
don't explain, round round, you just want to say the CPU parallel

We don't want to explain, "c # Paralle" baidu "c # thread pool thread scheduling," Windows isn't what you said the thread open thread, his own schedule, and round don't, don't you talk 1 w a thread, we want to high 5000 kcpu run?

If it is 1000 w of the user's request down concurrent execution efficiency of 1000 w/1 w, no multithreading time was 1000 seconds, opened a multithreaded after 1 second, I think really value, I want to ask is can perform 16 threads at the same time, ask not scheduling, I also know that open 1000 w thread cpu16 thread countless times the execution within 1 second, which is it the core of which is to calculate the operating system thread scheduling, but this can and at the same minimum unit parallel execution time 16 threads is not a concept

CodePudding user response:

This is the problem of the concept of concurrent and parallel,
The building Lord look to baidu,
I feel you need to know is parallel,
# 1 is the way, you don't go into "c # Paralle"

CodePudding user response:

reference 4 floor Bridge_go response:
even 2 nuclear, you open the 100 threads are ok, this is two concepts

If it is a double thread dual-core CPU, you don't have any problem, but I if it is a dual-core 4 thread? Or two core CPU by the operating system scheduler countless times, 1 seconds at a time to perform it? Then what's the use of the four threads, with two threads no difference

CodePudding user response:

refer to 7th floor LikeWatchStar response:
Quote: refer to 4th floor Bridge_go response:

Even 2 nuclear, you open the 100 threads are ok, these are the two concepts

If it is a double thread dual-core CPU, you don't have any problem, but I if it is a dual-core 4 thread? Or two core CPU by the operating system scheduler countless times, 1 seconds at a time to perform it? That what's the use of the four threads, with two threads no difference


You should not think, the CPU is finished must put a thread execution, to do the next we also can't explain,
The reality is, after all, Windows is a multitasking preemption system, the prerequisites are no, you can talk about

100 nuclear words according to your ideas, is not enough you use, you want to give me 1 + 2 + 3 + 1000000000000, then 101 threads to calculation of the above things, a nuclear will do the other thread, excuse me what to do with the 101th,

Now the problem comes again, I would like to send a suspension of operation instructions, priority is higher than the above 101, what is your idea, once finished? That the highest priority to suspend the instruction to who? In the use of a nuclear?

CodePudding user response:

refer to 7th floor LikeWatchStar response:
Quote: refer to 4th floor Bridge_go response:

Even 2 nuclear, you open the 100 threads are ok, these are the two concepts

If it is a double thread dual-core CPU, you don't have any problem, but I if it is a dual-core 4 thread? Or two core CPU by the operating system scheduler countless times, 1 seconds at a time to perform it? That what's the use of the four threads, with two threads no difference


Words, we build a toilet, and 2 more efficient than four pit pit, if you are not so say four pit and two timber distinction, the rest of us

CodePudding user response:

I know the scheduling, scheduling, don't tell me I'm like 16 nuclear parallel

Ok, scheduling: what is the meaning of the word itself, is not what time to what people do, that's what about

Dispatch system -- -- -- -- -- -- -- -- -- -- -- what time and for which the CPU, the nucleus, to perform the thread context

System level to be, that's ok with you, just a Windows system from a single core, a single CPU s, IBM didn't notify Microsoft to architecture, Microsoft only one release a version slowly adaptation

CodePudding user response:

References about the book content "in an age of multi-core processor before, single-threaded applications that run on a faster processor, the speed can be faster, but in the era of multi-core processors, can't again so simply thought that the question,"

CodePudding user response:

Space, increase the coordination for multithreaded

CodePudding user response:

Eight core refers to the eight CPU unit components, the eight cell components focus on a chip of a complete CPU chip,
A CPU unit components can be logically and divided into two CPU units, this is a single core CPU double thread, it's like your hard disk logically divided into several districts is a truth, though it is the same piece of hard disk, but each partition on the logic is relatively independent, can separate, speaking, reading and writing, the CPU thread, too, are the two threads of each nuclear logically also completely independent,
以8核16线程cpu为例,cpu在处理数据的时候,是操作系统根据外部程序的计算需求来统进行一分配的,16个线程具有同等的分配几率,当外部的计算需求只需要一个cpu线程就可以搞定时,操作系统随机分配一个cpu线程进行处理,当外部的计算需求比较大,比如你同时开了16个应用程序,假设每个应用程序都是单线程,那么理论上说cpu就会把这些应用程序分配给16线程去执行,这样执行的效率就会很高,使用者的用户体验就会好,这个我们称之为程序的并行,如果是单核单线程cpu,cpu在处理16个程序的计算请求的时候是按照一定的竞争机制由操作系统来分配时间片的,比如如果时间片的最小单位是1秒,那么第一秒处理16个程序中的某一个的计算请求,第二秒又处理16个程序中的某一个的计算请求,理论上来说,每一秒cpu处理哪个程序的请求都是随机的,不过,操作系统会在cpu正式处理之前先生成一个操作序列,cpu按照这个序列顺序执行,假设在一个16秒周期内cpu对16个程序是绝对的公平,那么单核单线程cpu每16秒只对一个应用程序处理的计算需求处理一秒,而8核16线程的cpu理论上可以处理16秒,当然,实际上的时间片比一秒小的多,以至于当我们的计算需求很小的时候,你根本感觉不出cpu多核多线程的用途所在,但是,当你玩大型网游或者在运行一些图像处理软件或者建模软件的时候,这种差别就体现出来了,因为这些程序对于计算需求是很高的,不仅计算的数据量大,计算的频次也高,单核,双核cpu在处理这些数据的时候压力就会比较大,在用户端的表现就是游戏画面很卡,游戏会有延时,图片处理渲染的时候会需要很久,而多核多线程的cpu处理起来就会高效很多,
Don't know how to explain these ever remove your doubts

CodePudding user response:

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • C#
  • Related