Mahesh Mallikarjunaiah ↗️’s Post

View profile for Mahesh Mallikarjunaiah ↗️, graphic

Engineering Leader | Technology Transformation | SaaS | Cloud | DevOps | Innovation

Understanding how the CPU works and how to write thread-efficient programs is very important. Thread Context Switching - When a program is executed in a single-core CPU, the CPU can work with and execute only one thread at any given time. Each thread gets its share of CPU time. For example, when a thread is writing something to the disk, and if it's consuming time, the CPU switches to another thread while the earlier thread is waiting. Threads are context-switched, and it looks like it is multitasking, and things are going on in parallel, which is not. Processing : Sequential processing is where programs are executed in a sequence, one by one, getting allocated with the CPU Concurrency: Parts of the program can be run independently and combined for the result and to speed up the execution on a single CPU Parallel: Each program can be run on each CPU independently and combined for the final results to speed up the execution Single Vs. Multi-thread - By running multiple threads vs. single threads to execute a program, the overall execution time can be reduced, and efficiency can be improved. Process Vs. Threads: A process uses CPU, memory, disk, and other resources to execute a program. A process can spin up one or multiple threads to complete the job. Sync Vs Asyn: Sync is executed in a sequence and cannot be skipped, but Asyn can run its block of the program separately from the main program and doesn't have to wait for completion to move on Thread Deadlock: When the resources required by a thread are being blocked by another one, and each one is waiting on another one, it leads to a deadlock state #cpu #development #technology #softwaredesign

  • No alternative text description for this image
Surinder Kumar Mehra

Principal Engineer at Arcesium

5mo

Could you please explain why summing numbers 1-100 is faster using two threads(1-50,50-100) on a single core cpu when no io is involved. Or you assumed cpu is multi core in this example?

Garvan Power

Assist Vice President. Boarding and Service Technology, EU

5mo

Very good graphic to represent CPU architecture but I feel the section called thread context switching needs to be defined more accurately. Context switching is a change in the state of a process, like when the kernel suspends the execution of process in order to resume the execution of a previously suspended process, or some new process spawns that needs kernel privileges. So to call that section Thread Context Switching is not accurate. Threads never change context. Only processes change context. I’m being a little pedantic here but I feel clarity is critical when discussing CPU architecture as it can get confusing. :-)

Kiran Kokare💎

Program Manager | Strategic Business Analysis & Development Essentials | Business Transformation | IT Recruitment | Strategic Change Manager | Driving Digital Transformation | Enabling Operational Excellence |

5mo

“Thrilled to share insights on CPU architecture and thread efficiency! As a seasoned software developer with a passion for optimizing performance, I’ve delved deep into the inner workings of CPUs. From clock speeds and cache levels to pipelining and out-of-order execution, I’ve honed my understanding of these critical components. Additionally, my expertise extends to writing thread-efficient programs. Whether it’s avoiding global locks, leveraging thread pools, or ensuring thread safety, I’m committed to maximizing concurrency while minimizing bottlenecks. Let’s connect and explore the fascinating world of software optimization!” 

Victor Raul Maye Mamani

Desarrollador Fullstack | Frontend | Backend | Analista de datos | React | Next.js | Node.js | JavaScript | TypeScript | Tailwind CSS |RESTful API | Python | SQL | MongoDB

5mo

Thanks for sharing

Dharmender Jangra

• Server | Network Mgmt | DATA CENTRE Virtual and physical servers & SAN | Oracle DBA | Oracle fusion & IBM WAS middleware administrator | VERITAS AND COMMVAULT administrator

5mo

Thanks for sharing

Gaurav Pandey

LinkedIn Top Voice’24 | Software Engineer | 🚀 68K+ @LinkedIn Family | MERN Stack ⚛️ | React NodeJS | Full Stack Developer | Mentor

5mo

Threads orchestrate concurrency, enabling efficient resource utilization and performance optimization.

Raul Junco

Simplifying System Design

5mo

“Threads are context-switched, and it looks like it is multitasking, and things are going on in parallel, which is not.” 👌🏻 Simply explained, Mahesh Mallikarjunaiah ↗️

Victor Quezada Hernández

Soporte TI e Infraestructura

5mo

Very informative and interesting. Thanks for posting.

Hina Arora

Career Branding Coach mentoring techies to create an online presence for Job Opportunities & Career Growth | Mentored 1000+ people | Career Development Coach | Public Speaker | Engineering Manager at Jio

5mo

Mahesh Mallikarjunaiah ↗️ Understanding CPU utilization and thread efficiency is crucial for optimizing program performance across different processing paradigms. 

See more comments

To view or add a comment, sign in

Explore topics