Telegram Group & Telegram Channel
چرا Multi-Threading در پایتون مثل جاوا کار نمی‌کنه؟

از لینکدین Majid BagherZadeh
کامنت های پستش رو بخونید. لینک این پست

یکی از تفاوت‌های جالب بین زبان‌های برنامه‌نویسی اینه که "Thread" در هر زبان لزوماً به معنای واقعی خودش اجرا نمی‌شه!

🔹 در جاوا، Threadها واقعاً می‌تونن روی چندین هسته CPU اجرا بشن، مخصوصاً حالا که با Virtual Threads در جاوا ۲۱، اجرای هم‌زمان بسیار سبک‌تر و مقیاس‌پذیرتر شده.

🔹 اما در پایتون، یک چیزی به نام GIL (Global Interpreter Lock) وجود داره که باعث می‌شه در هر لحظه فقط یک Thread بتونه اجرا بشه، حتی اگه چند Thread ساخته باشیم! به همین خاطر، در پایتون برای استفاده از تمام هسته‌های CPU معمولاً به جای Multi-Threading از Multi-Processing استفاده می‌کنن.

💡 نتیجه؟
اگر توی جاوا Thread بسازید، واقعاً روی چند هسته اجرا می‌شه. اما توی پایتون، ساختن چندین Thread لزوماً به معنی اجرای هم‌زمان واقعی نیست! به جای اون، در پایتون پردازش‌های موازی بیشتر با Multi-Processing انجام می‌شن تا بتونن از همه‌ی قدرت CPU استفاده کنن.

🔥 این یکی از اون تفاوت‌هایی‌ـه که اگر بهش دقت نکنید، ممکنه فکر کنید Multi-Threading همیشه همون معنی رو داره—ولی در عمل، بستگی داره که توی چه زبانی کار می‌کنید!

🚀 شما چقدر به این تفاوت‌ها توجه کردید؟ تجربه‌ای در این زمینه داشتید؟



tg-me.com/djangolearn_ir/1025
Create:
Last Update:

چرا Multi-Threading در پایتون مثل جاوا کار نمی‌کنه؟

از لینکدین Majid BagherZadeh
کامنت های پستش رو بخونید. لینک این پست

یکی از تفاوت‌های جالب بین زبان‌های برنامه‌نویسی اینه که "Thread" در هر زبان لزوماً به معنای واقعی خودش اجرا نمی‌شه!

🔹 در جاوا، Threadها واقعاً می‌تونن روی چندین هسته CPU اجرا بشن، مخصوصاً حالا که با Virtual Threads در جاوا ۲۱، اجرای هم‌زمان بسیار سبک‌تر و مقیاس‌پذیرتر شده.

🔹 اما در پایتون، یک چیزی به نام GIL (Global Interpreter Lock) وجود داره که باعث می‌شه در هر لحظه فقط یک Thread بتونه اجرا بشه، حتی اگه چند Thread ساخته باشیم! به همین خاطر، در پایتون برای استفاده از تمام هسته‌های CPU معمولاً به جای Multi-Threading از Multi-Processing استفاده می‌کنن.

💡 نتیجه؟
اگر توی جاوا Thread بسازید، واقعاً روی چند هسته اجرا می‌شه. اما توی پایتون، ساختن چندین Thread لزوماً به معنی اجرای هم‌زمان واقعی نیست! به جای اون، در پایتون پردازش‌های موازی بیشتر با Multi-Processing انجام می‌شن تا بتونن از همه‌ی قدرت CPU استفاده کنن.

🔥 این یکی از اون تفاوت‌هایی‌ـه که اگر بهش دقت نکنید، ممکنه فکر کنید Multi-Threading همیشه همون معنی رو داره—ولی در عمل، بستگی داره که توی چه زبانی کار می‌کنید!

🚀 شما چقدر به این تفاوت‌ها توجه کردید؟ تجربه‌ای در این زمینه داشتید؟

BY جنگولرن




Share with your friend now:
tg-me.com/djangolearn_ir/1025

View MORE
Open in Telegram


جنگولرن Telegram | DID YOU KNOW?

Date: |

Telegram and Signal Havens for Right-Wing Extremists

Since the violent storming of Capitol Hill and subsequent ban of former U.S. President Donald Trump from Facebook and Twitter, the removal of Parler from Amazon’s servers, and the de-platforming of incendiary right-wing content, messaging services Telegram and Signal have seen a deluge of new users. In January alone, Telegram reported 90 million new accounts. Its founder, Pavel Durov, described this as “the largest digital migration in human history.” Signal reportedly doubled its user base to 40 million people and became the most downloaded app in 70 countries. The two services rely on encryption to protect the privacy of user communication, which has made them popular with protesters seeking to conceal their identities against repressive governments in places like Belarus, Hong Kong, and Iran. But the same encryption technology has also made them a favored communication tool for criminals and terrorist groups, including al Qaeda and the Islamic State.

Telegram today rolling out an update which brings with it several new features.The update also adds interactive emoji. When you send one of the select animated emoji in chat, you can now tap on it to initiate a full screen animation. The update also adds interactive emoji. When you send one of the select animated emoji in chat, you can now tap on it to initiate a full screen animation. This is then visible to you or anyone else who's also present in chat at the moment. The animations are also accompanied by vibrations. This is then visible to you or anyone else who's also present in chat at the moment. The animations are also accompanied by vibrations.

جنگولرن from nl


Telegram جنگولرن
FROM USA