Dab tsi yog synchronous thiab asynchronous hauv node JS?
Dab tsi yog synchronous thiab asynchronous hauv node JS?

Video: Dab tsi yog synchronous thiab asynchronous hauv node JS?

Video: Dab tsi yog synchronous thiab asynchronous hauv node JS?
Video: dab neeg Tub Mua Thiab Yiv Tuag Ua Dab Los 09/19/2021 2024, Kaum ib hlis
Anonim

Hauv programming, synchronous kev ua haujlwm thaiv cov lus qhia kom txog thaum ua tiav, thaum asynchronous kev ua haujlwm tuaj yeem ua tiav yam tsis thaiv lwm yam haujlwm. Asynchronous Kev ua haujlwm feem ntau ua tiav los ntawm kev tua ib qho kev tshwm sim lossis los ntawm kev hu xovtooj hu rov qab ua haujlwm.

Ib yam li ntawd, koj tuaj yeem nug, yog node JS synchronous lossis asynchronous?

Node . js khiav ntawm ib kab lus thaum cov lus sau ntawv siv ntau cov xov. Asynchronous txhais tau hais tias tsis muaj lub xeev thiab qhov kev sib txuas tsis tu ncua thaum lub sijhawm synchronous yog (yuav luag) opposite.

Ib yam li ntawd, txhais li cas los ntawm synchronous thiab asynchronous? Synchronous thiab asynchronous kev sib kis yog ob txoj kev sib txawv ntawm kev sib kis synchronization . Synchronous kis tau tus mob synchronized los ntawm lub moos sab nraud, thaum asynchronous kis tau tus mob synchronized los ntawm cov cim tshwj xeeb raws qhov nruab nrab kis tau tus mob.

Kuj kom paub yog, qhov txawv ntawm synchronous thiab asynchronous hauv JavaScript yog dab tsi?

Nyob rau hauv Summary Yog li los recap, synchronous code raug ua tiav hauv ntu - txhua nqe lus tos rau nqe lus dhau los kom tiav ua ntej ua tiav. Asynchronous code tsis tas yuav tos - koj qhov program tuaj yeem khiav mus ntxiv. Koj ua qhov no kom koj lub vev xaib lossis app teb, txo lub sijhawm tos rau tus neeg siv.

Dab tsi yog asynchronous hauv node JS?

JavaScript yog asynchronous nyob rau hauv qhov thiab yog li ntawd Node . Asynchronous programming yog ib qho qauv tsim uas ua kom tsis txhob thaiv cov lej ua tiav. Asynchronous puas yog opposite, asynchronous code executes yam tsis muaj kev vam khom thiab tsis muaj kev txiav txim. Qhov no txhim kho qhov system efficiency thiab throughput.

Pom zoo: