A multi-threaded application server

Above figure shows three concurrent requests to a program that has five threads. All three requests wait that the execution is very near.

lets say if we want to execute the same block of code called myPopularProc(). As the figure shows, each one of these threads can execute this code at the same time (since the CPU runs one thread at a time, this is not quite true, but it's very close depending on the function). In fact, each thread is currently executing a different line of code, as the figure shows. Thus, threads do not have toin line to execute the same piece of code. They can be interleaved so that the execution is nearly parallel.

要查看或添加评论,请登录

?? Saral Saxena ???????的更多文章

社区洞察

其他会员也浏览了