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 Telegram | DID YOU KNOW?

Date: |

That strategy is the acquisition of a value-priced company by a growth company. Using the growth company's higher-priced stock for the acquisition can produce outsized revenue and earnings growth. Even better is the use of cash, particularly in a growth period when financial aggressiveness is accepted and even positively viewed.he key public rationale behind this strategy is synergy - the 1+1=3 view. In many cases, synergy does occur and is valuable. However, in other cases, particularly as the strategy gains popularity, it doesn't. Joining two different organizations, workforces and cultures is a challenge. Simply putting two separate organizations together necessarily creates disruptions and conflicts that can undermine both operations.

How to Invest in Bitcoin?

Like a stock, you can buy and hold Bitcoin as an investment. You can even now do so in special retirement accounts called Bitcoin IRAs. No matter where you choose to hold your Bitcoin, people’s philosophies on how to invest it vary: Some buy and hold long term, some buy and aim to sell after a price rally, and others bet on its price decreasing. Bitcoin’s price over time has experienced big price swings, going as low as $5,165 and as high as $28,990 in 2020 alone. “I think in some places, people might be using Bitcoin to pay for things, but the truth is that it’s an asset that looks like it’s going to be increasing in value relatively quickly for some time,” Marquez says. “So why would you sell something that’s going to be worth so much more next year than it is today? The majority of people that hold it are long-term investors.”

telegram from sa


Telegram جنگولرن
FROM USA