Dab tsi yog ib leeg threaded event loop?
Dab tsi yog ib leeg threaded event loop?

Video: Dab tsi yog ib leeg threaded event loop?

Video: Dab tsi yog ib leeg threaded event loop?
Video: Tips to avoid Loop Problem in Sewing Machine || Tailoring Class Part - 1|| In Tamil | 2024, Kaum ib hlis
Anonim

Txheej xwm Loop - Txhais tau tias ib threaded lub voj voog infinite uas yog ua ib txoj hauj lwm ntawm ib lub sij hawm thiab nws tsis yog tsuas yog ua ib leeg ua hauj lwm queue, tab sis nws kuj tseem ceeb cov hauj lwm, vim nrog xov xwm txheej koj tsuas muaj ib qho peev txheej forexecution (1 xov ) yog li txhawm rau ua tiav qee yam haujlwm tam sim ntawd koj xav tau kev ua haujlwm tseem ceeb.

Ua raws li qhov no hauv kev xav, dab tsi yog ib qho kev tshwm sim lub voj voog qauv?

Ib Threaded Event Loop Model ProcessingSteps: Cov neeg siv xa ntawv thov rau Web Server. Node JS Web Serverinternally tuav ib qho txwv Xov pas dej ua ke muab kev pab cuam rau cov neeg thov. Node JS Web Server tau txais cov lus thov thiab muab tso rau hauv ib qho Daim ntawv . Nws yog lub npe hu ua Txheej xwm Queue ”.

Qhov thib ob, yuav ua li cas node yog ib leeg threaded? Tag nrho Node Cov ntawv thov JS siv " SingleThreaded Kev tshwm sim Loop Model "architectural rau handler ntau concurrent neeg. Lub ntsiab kev tshwm sim voj yog ib leeg - xov tab sis feem ntau ntawm I / O ua haujlwm khiav cov xov sib cais, vim tias I / O APIs hauv Node .js areaynchronous/non-blocking by design, in order to accommodate theevent loop.

Ib yam li ntawd, ib leeg threaded txhais li cas?

Ib leeg threaded cov txheej txheem muaj qhov ua tiav cov lus qhia hauv a ib leeg ib ntus. Hauv lwm lo lus, onecommand yog cov txheej txheem ntawm ib lub sijhawm. Qhov opposite ntawm ib leeg xov txheej txheem yog multithreaded txheej txheem. Cov txheej txheem no tso cai rau kev ua tiav ntawm ntau qhov chaw ntawm ib qho kev pab cuam tib lub sijhawm.

Nws txhais li cas tias JavaScript yog ib leeg threaded?

Javascript yog a ib threaded lus. Qhov no txhais tau tias nws muaj ib tug hu pawg thiab ib tug nco heap. Raws li xav tau, nws ua tiav cov cai hauv kev txiav txim thiab yuav tsum ua kom tiav kev ua tiav ib qho chaws ua ntej tsiv mus rau lwm qhov. Cov pawg hu tau lees paub txog kev ua haujlwm ntawm Web API thiab muab lawv tso rau hauv qhov browser.

Pom zoo: