Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Thisismattwade

macrumors 6502
Original poster
Oct 27, 2020
262
299
Hi all,

This is probably basic knowledge around here, but I've been thinking about my family's (base) M1 MBA (with two users with Fast User Switching enabled). It has 8 CPU cores (I think), and I've read a lot of threads talking about each core really doing one task at a time. So if I'm logged into my desktop, does that mean it can do 8 tasks simultaneously without me noticing a hiccup? I'm assuming System Services (or whatever it's called) is always doing "things" in the background: checking for updates, monitoring wireless connections for new devices to join, checking the ambient lighting to adjust screen brightness, updating my iCloud Photos/Messages/etc. Does that just take 1 CPU core? And then if I'm actively typing in Messages while listening to the Jurassic Park soundtrack in Music and my work Edge profile is running (with 4 tabs open) as a full-screen app, is that 3 cores being used, one for each task? What if my wife is also logged into her username (for Fast User Switching at a moment's notice)? Also, what is my (8GB of) RAM doing all this time? I can't imagine any file I've ever worked on with this computer is anywhere near 8GB: maybe a 1GB movie in Photos (that is compressed with Optimize Storage on)?

Obviously none of the above is "Pro" level stuff, and I just simply enjoy our MBA as a really neat machine, but I've always associated more cores with better. I'm starting to think I don't understand the dynamic, or I at least want to understand it better.

Thanks for your help!
 

chown33

Moderator
Staff member
Aug 9, 2009
10,998
8,887
A sea of green
I'm assuming System Services (or whatever it's called) is always doing "things" in the background: checking for updates, monitoring wireless connections for new devices to join, checking the ambient lighting to adjust screen brightness, updating my iCloud Photos/Messages/etc. Does that just take 1 CPU core? And then if I'm actively typing in Messages while listening to the Jurassic Park soundtrack in Music and my work Edge profile is running (with 4 tabs open) as a full-screen app, is that 3 cores being used, one for each task?
The basic answer to most of these questions is, "The OS is multitasking".

There's a simplified description in the introductory paragraphs of the following article:

A single CPU core by itself can perform multitasking, and many still do. That is, there are many single-core CPUs that perform multi-tasking, thus giving the appearance of multiple tasks running all at once, when the reality is that it's just a single CPU rapidly switching between tasks.

It's almost never the case that a single core or CPU only runs a single task. I wrote "almost never" but for all practical purposes it's never. I'm just hedging myself because if I wrote "never" then someone would come up with an obscure situation, and then I'd have to hedge it anyway.

The earliest versions of Mac OS X ran on single-core CPUs, namely PowerPC CPUs. There were no multi-core PowerPCs at the time, so to get multiple CPUs took multiple CPU chips. That was eventually offered, but there are many older PowerPC Macs that have only a single CPU in them, and they multitask just fine.
 

picpicmac

macrumors 65816
Aug 10, 2023
1,239
1,833
It has 8 CPU cores (I think)
Most of the time they are not doing much of anything.

Simple reality: almost all the cycles (in the M1 case over 3 billion of them per second) of every CPU ever made on this planet go wasted.

If you open up Activity Monitor and look at the "CPU" tab, you will see a list of all the tasks currently running. You can order the list by how much CPU time each task has consumed (since the last reboot if they start on reboot, or the last time you opened the program). You will find a great many tasks that have only consumed a few minutes, or maybe even a few seconds, even if you rebooted weeks ago. Your most used programs will have the most CPU time - often these are web browsers for the typical person. For me it is Firefox, currently at 7 days, 2 hours, 35 minutes. But even then, that doesn't really count how many clock cycles were effectively used.

As another post explained, multitasking can be done on a single CPU. Multiple "cores" are intended to add capability but most people only use those multiple cores on occasion.
 

Thisismattwade

macrumors 6502
Original poster
Oct 27, 2020
262
299
The basic answer to most of these questions is, "The OS is multitasking".

There's a simplified description in the introductory paragraphs of the following article:

A single CPU core by itself can perform multitasking, and many still do. That is, there are many single-core CPUs that perform multi-tasking, thus giving the appearance of multiple tasks running all at once, when the reality is that it's just a single CPU rapidly switching between tasks.

It's almost never the case that a single core or CPU only runs a single task. I wrote "almost never" but for all practical purposes it's never. I'm just hedging myself because if I wrote "never" then someone would come up with an obscure situation, and then I'd have to hedge it anyway.

The earliest versions of Mac OS X ran on single-core CPUs, namely PowerPC CPUs. There were no multi-core PowerPCs at the time, so to get multiple CPUs took multiple CPU chips. That was eventually offered, but there are many older PowerPC Macs that have only a single CPU in them, and they multitask just fine.
Thanks, that's helpful. I think I knew that, but I appreciate you reminding me that essentially processors are so fast that in a meaningful amount of time (say 1 second) even 1 core can do so much work so efficiently in a modern OS.

Most of the time they are not doing much of anything.

Simple reality: almost all the cycles (in the M1 case over 3 billion of them per second) of every CPU ever made on this planet go wasted.

If you open up Activity Monitor and look at the "CPU" tab, you will see a list of all the tasks currently running. You can order the list by how much CPU time each task has consumed (since the last reboot if they start on reboot, or the last time you opened the program). You will find a great many tasks that have only consumed a few minutes, or maybe even a few seconds, even if you rebooted weeks ago. Your most used programs will have the most CPU time - often these are web browsers for the typical person. For me it is Firefox, currently at 7 days, 2 hours, 35 minutes. But even then, that doesn't really count how many clock cycles were effectively used.

As another post explained, multitasking can be done on a single CPU. Multiple "cores" are intended to add capability but most people only use those multiple cores on occasion.
Also very helpful, thank you. As a novice MacOS user (not my daily driver) I'm not well versed in Activity Monitor. I'll give it a look next time I'm playing with the MBA!
 

tis100

macrumors member
Jun 27, 2022
51
92
A simple analogy for a CPU is a bank.

The number of cores is equivalent to the number of tellers available to service customers. Your M1 MBA would have 8 tellers.

In a heterogeneous CPU like the Apple M1 there are also different types of cpu cores. Some cores are high performance and others are high efficiency. This would be equivalent to more experienced vs less experienced tellers. The more experienced tellers are allowed to handle more types of tasks and can process customers more quickly, but are paid more (i.e. use more power). The less experienced tellers are restricted in the types of tasks they are allowed to process and are generally slower than their more experienced colleagues, but are paid less (i.e. use less power). Your M1 MBA would have 4 experienced tellers and 4 less experienced tellers.

The operating system, MacOS, has a scheduler that allocates the amount of time a program can run on a CPU core. This is equivalent to a bank having a policy that says each teller should spend no more than X amount of time per customer depending on the length of the queue, otherwise they have to tell the customer to come back another time. In a computer the amount of time allocated is in the order of milliseconds.

There are also instances were an operating system and/or CPU can interrupt a CPU core to process an important task. This is equivalent to the bank manager coming up to one of the tellers and asking them to handle something ASAP.

CPUs generally have a limited amount of memory relative to the amount necessary to handle all the programs that run. That's where RAM and SSD storage come in. It would be impossible for the tellers in the bank to memorize all the customer information. Instead, when a customer comes up to a teller they can provide some basic information and the teller can then go to the backroom filing cabinet (SSD) and pull out their file. The teller extracts all the papers in the file and spreads them out on their desk. The desk with all the papers now constitutes the working memory (RAM). The teller can reference, append, update and remove data from these papers. And when the teller is done, they can reorganize the papers into a file and store them in the filing cabinet (SSD).

Unfortunately, interacting with the filing cabinet is a slow process, and if the same customers are going to return soon, the teller might as well leave the papers close by. Naturally, the number of papers on the desk increases over time and eventually, if there is not enough desk space, the teller may be forced to file some of the papers away (swapping).
 

ChrisA

macrumors G5
Jan 5, 2006
12,918
2,170
Redondo Beach, California
Hi all,

This is probably basic knowledge around here, but I've been thinking about my family's (base) M1 MBA (with two users with Fast User Switching enabled). It has 8 CPU cores (I think), and I've read a lot of threads talking about each core really doing one task at a time. So if I'm logged into my desktop, does that mean it can do 8 tasks simultaneously without me noticing a hiccup?...
If you look at all the processes that are running on your Mac you see that there are over 2,000 threads running. It would take far too long to describe what each one is doing. On my Mac right now I see about 2,700 to 2,800 running and the numbers jump up and down. Most of these threads are what they call "blocked". This means they are waiting on some event like perhaps some data to arrive over some interface. I assume there are a number of unblocked threads that could run if a CPU-core were available. I call these threads "waiting". There is a scheduler in the OS that assigns cores to waiting threads. The more cores you have the faster queue of "waiting" threads can be worked off.

On the other hand, many times all but a couple of threads are blocked so you have more cores available than waiting threads. This is the usual case and several of the cores will be idle, doing nothing.

So, no, it is not the case that if there are 8 cores the computer is doing 8 things. It is likely doing thousands of things but most of those things are waiting. But with 8 cores it can run at most 8 threads at the same time.

But let's say you were doing some video editing and clicked the "render" button. The software would start some large numbers of threads, each doing some part of the job. The scheduler would assign cores to threads until it ran out of available cores. So having more cores lets more f those render threads run at the same time.

The above logic works even on computers with only one core or on computers with 100+ cores. The more cores you have the better chance one will be available to run a thread and overall the system will be faster.
 
  • Like
Reactions: Sybere

Basic75

macrumors 68020
May 17, 2011
2,101
2,448
Europe
Thanks, that's helpful. I think I knew that, but I appreciate you reminding me that essentially processors are so fast that in a meaningful amount of time (say 1 second) even 1 core can do so much work so efficiently in a modern OS.
The Amiga did preemptive multitasking in 1986 on a single 7Mhz (MHz!) processor and it worked surprisingly well.
 

ChrisA

macrumors G5
Jan 5, 2006
12,918
2,170
Redondo Beach, California
The Amiga did preemptive multitasking in 1986 on a single 7Mhz (MHz!) processor and it worked surprisingly well.
MacOS and IOS are eventually BSD UNIX with a pretty graphical user interface. BSD UNIX dates from 1968. There were good multitasking systems in use well before 1968. FOr example "UNIX" was a word-play on the previous system called "Multix". Multix was quite complex and UNIX was simpler and ra on very low-end hardware.

I've personally worked on a couple of different 4-core multitasking systems that date from the mid 1960s. One from CDC and another from Univac. They were probably as powerful as the Amiga. These were antiques when I worked on them but were still in use. I was into OS internals back then and I can say that not much has changed in all those years, except that now the hardware costs less.

It's actually disappointing to think that so little innovation has been made in all those years. The basic design of what we call macOS/IOS was put down on the late 1960s
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.