Releasing finished task's stack

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
invalid
Member
Member
Posts: 60
Joined: Thu Feb 23, 2012 8:39 am

Re: Releasing finished task's stack

Post by invalid »

Rudster816 wrote:I think it's much better to lazily release resources (...)
I come to the same conclusion. Resources might be free (unused) already, but not yet fully recognized as such; no need to hurry until they are needed (after all, CPU time is also a resource).
User avatar
brain
Member
Member
Posts: 247
Joined: Thu Nov 05, 2009 5:04 pm
Location: UK
Discord: https://discord.gg/brainbox
GitHub: https://github.com/braindigitalis
Contact:

Re: Releasing finished task's stack

Post by brain »

Imho cpu time is the resource you need to be most efficient with. to some extent you can be 'wasteful' of ram, e.g. sacrifice some in the name of cpu performance.

This is personal opinion because usually a user can upgrade ram easily by adding more to the motherboard but as for adding a faster cpu this often can mean a new motherboard, which entails new ram etc, basically a new system. just my own personal 0.02$ on scalability.
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: Releasing finished task's stack

Post by bluemoon »

Today, you can buy 4GiB DDR3 with only USD$20 :lol:
So I expect 16GiB system getting more common, and there is A LOT to waste for hobby OS :twisted:
Rudster816
Member
Member
Posts: 141
Joined: Thu Jun 17, 2010 2:36 am

Re: Releasing finished task's stack

Post by Rudster816 »

brain wrote:Imho cpu time is the resource you need to be most efficient with. to some extent you can be 'wasteful' of ram, e.g. sacrifice some in the name of cpu performance.

This is personal opinion because usually a user can upgrade ram easily by adding more to the motherboard but as for adding a faster cpu this often can mean a new motherboard, which entails new ram etc, basically a new system. just my own personal 0.02$ on scalability.
While keeping kernel CPU time to a minimum is obviously a good idea, CPU time is very, very cheap in term of system resources IMO. The way I view a CPU is some insanely hungry beast, so hungry in fact its nearly impossible to shovel enough data down its throat as fast as it can eat it. The CPU\Memory speed difference is getting better because of larger CPU caches and faster memory, but the system bus is getting hammered by 4+ CPU's in a lot of systems, which means main memory access is very expensive in terms of CPU cycles. IIRC, when I looked at the Intel Nehalem microarchitecture optimization manual, it said that even L3 cache fills are like ~73 cycles on those chips. It gets much worse when you run into chips like mine which are overclocked to 4.0ghz+ too. Even with out of order execution, no compiler will be able to generate even half that many cycles before performing an operation on that memory access.


I have two machines, one desktop with 12GB of memory and an i7 920 (4 cores\8 threads) at 4ghz, and a laptop with an AMD-E450 (a super low power dual core chip) and 4GB of memory. The difference between using the two are like night and day obviously, but one of the most the things that impresses me the most about Windows (7 in this case) is the difference in how much memory it uses between the two. When I first booted after reinstalling Windows on my dekstop, memory usage was at like 2GB, where it was just under 1GB on my laptop (albeit with a tiny bit of bloat from Lenovo, but not at all bad). Being able to double your OS's memory use based on available memory (or the inverse, cutting it in half) really impresses me. My brother even has a laptop with 1GB of memory that runs Win7 just fine.

Moral of the story is know how much memory the machine your OS is running on has, and take advantage. While some less informed people will complain about high memory usage, so long as it can scale back down if the need arises, better informed people will know that it will speed things up.
Post Reply