Unless you're talking about "converting" the bacteria into something useful (ex., something that can be used to selectively kill other types of bacteria, or do some kind of useful work inside the human body), I'd say that any resources put into trying to shape the "evolution" of a given type of (harmful) bacteria would be much better applied simply finding ways to kill it.
Simply creating a new strain of bacteria doesn't magically make existing strains disappear. You can domesticate one tiger but, unless you kill all the wild ones, you're still at risk if you take a stroll through the jungle.
You're mostly right, but not entirely. The difference is that with simple forms of life, such as bacteria, their DNA copying process isn't as error-free as ours (and even ours isn't 100% error free). So every time they divide, a number of mutations occur.
And how does that contradict any of what I wrote? I kind of assumed that the average Slashdot reader is aware of the fact that random mutations occur (and not just during division / reproduction, although that's the most likely moment). Did I walk into a creationist website by mistake?
If one of those mutations end up giving them some resistance to the antibiotic, that strain is going to dominate
It's not hard to "dominate" when you happen to be resistant or immune to a poison that has killed or is killing everyone round you. But it's not the antibiotic that grants the bacteria the resistance (that would be kind of counter-productive). If they are not resistant to it at the time when they are exposed, they die (or become unable to reproduce and then die, or whatever). The antibiotic simply changes the balance of different bacterial strains.
Using language like "bacteria exposed to this antibiotic might grow a resistance" misleads people into thinking that bacteria have some kind of "immune system", capable of learning from the challenges it is faced with, which is simply not true. A lot of people actually think that every time you take antibiotics, the bacteria in your body "get stronger" (yes, I know it's a ridiculous notion, but ask around - you'll be amazed). And part of the reason for that is this kind of language.
However, if there's no environmental pressure, there's no guarantee that particular mutation will be successful
The concept of "successful" or "unsuccessful" only makes sense when evaluated against environmental pressures (whether from an antibiotic or simply from competition against other strains / genera of bacteria).
My problem (in case it's still not clear) is with language that suggests that exposure to an antibiotic "makes bacteria stronger". It doesn't. It makes most of them dead. It's just that all that death happens to leave an opening for the ones that weren't affected by the antibiotic. But even those don't "get stronger" (they were already "stronger", if by "stronger" you mean "more resistant to this particular challenge"), they simply get a chance to increase in number, by filling the space freed by the death of the other (less lucky) strains.
Let's not attribute deliberative (self) improvement ("learning to resist the antibiotic and becoming stronger") to what is a process of environmental selection. Otherwise we might as well march happily into the dead end of "intelligent design".
It is fine to use the shorthand "grow a greater resistance" to explain the behavior of the strain's evolution. [...] s/he used a layman-accessible shorthand.
I disagree. I don't think it is fine, because "laymen" will interpret that as "bacteria that have contact with an antibiotic will learn how to resist it". Ask around and you'll find that most people belive this. That is, after all, how our immune system works, and how humans (and other complex life forms) deal with challenges.
They don't understand the difference between individual bacteria adaptation ("bacteria growing a resistance") - which doesn't really happen - and strain evolution through (random) mutation and environmental selection (followed by multiplication).
So, when most people are ignorant and when most journalists are ignorant, one would hope that at least the scientists would make an effort to use language that is correct, even if it requires an IQ above 85 (or the ability to open a book and read a couple of pages) to understand. Using "simplified" language that is misleading or plain wrong might get through to more people but achieves the opposite of what it should. In this case, it reinforces people's perception of a selective process as an adaptative process (at the individual organism level). And then they wonder why people fall for nonsense like creationism and intelligent design.
Hell, most people don't even know the real name of Darwin's theory. Calling it "evolution" is missing the point. I guess it's "simpler" than "natural selection" (two words - double the complexity!), although "evolution" just means "change over time" and "natural selection" sums up the actual process.
So we get bacteria who adapt to live in conditions that are totally unlike the conditions inside a human body.
It's really not a matter of what "conditions inside the human body" are like. Conditions inside the human body don't normally include the presence of vast amounts of amoxicillin, for example. And yet, when you have a bacterial infection, taking amoxicillin tablets will get rid of them for you.
Bacteria that aren't "adapted to the conditions inside the human body" aren't a threat to begin with, so they're irrelevant. The problem with antibiotic resistance is that, if you wipe out 99% of bacteria, leaving only the 1% that are resistant to that antibiotic, when those multiply to fill the space left by the ones you killed, you have as many bacteria as you started with, but now your antibiotic is useless.
Not that the arguments in TFA make much sense, mind you, but saying that bacterial resistance is only an issue if they're "adapting to conditions inside the human body" is missing the point. Normal conditions inside the human body don't include antibiotic drugs.
A researcher [...] pointed out the problem [...]: "[A]nything that survives and sticks around grows greater resistance"
If those were his words, then I guess this "researcher" needs to do a bit more research, perhaps starting with a book written by a certain "Charles Darwin".
If the bacteria "stick around" it's because they are already resistant. Meaning they get to multiply, not to "grow greater resistance" (if they survived, their resistance is as "great" as it needs to be).
All that antibiotics do (in the long run) is change the relative populations of different kinds of bacteria (eliminating the ones that aren't resistant, leaving more room and resources for the resistant ones to grow). They don't actively make bacteria "get stronger", as the quote suggests. It's not as if the bacteria send a sample of the antibiotic to their underground lab where bacterial boffins come up with an antidote. They don't even have proper immune systems.
It's annoying when even "scientists" attribute some sort of "guiding intelligence" to the process of natural selection (or to individual bacteria, for that matter).
P.S. - And yes, I'm aware of plasmids, but bacteria can't suddenly rush out to buy some when they need them [ * ], so it's still a matter of selection, not "self-improvement".
It's not RAM manufacturers, it's the whole computer industry...
No, it isn't. Kilo (k) means "multiplied by one thousand", Mega (M) means "multiplied by one million", and so on. The prefix is part of the SI and means the same in every field of science and engineering. It's only (some) software and RAM manufacturers that get it wrong, basically because they decided 1024 was "close enough" to 1000 to be called "kilo", and then the error added up when using bigger values.
Hard disks use the correct factor, and so do network connections, most optical discs, streaming video bitrates, CPU clock speeds, and so on.
If you want to use the 1024 factor, just use ki, Mi, Gi, and so on (personally I preferred the k2, M2, G2 prefixes, but they didn't catch on - I guess the guys at the IEC love saying kibi-mebi-gibi).
alt-tab between it and Photoshop without spending 10 seconds thrashing the page file every time.
When was the last time, in the past 4 or 5 years, that you spent ten seconds (or even five) switching between a browser and Photoshop? It simply doesn't happen anymore (and note that I have a browser open 24/7 and run photoshop about 8 hours a day, frequently with images over 4k x 4k). You're more likely to have to wait for Photoshop to switch between two large images, but that's because Photoshop's own virtual memory management isn't terribly smart.
Oh, and Opera lets you set limits for both disk and memory cache. Not that it's particularly useful; I generally leave the memory cache set to "auto"; it will monitor free memory and decide how much to use (it rarely uses more than 200 MB, but maybe that's because I rarely visit pages with huge amounts of data).
In any case, even if your browser has 2 GB of memory allocated, it's extremely unlikely it will actually be using all of it at the same time, and the less used parts will eventually get swapped out by the OS.
while the software *might* be able to tell how much physical RAM is available, it has no way of knowing how much of that it is OK to take.
Just as it has no way of knowing how many CPU cycles it's okay to take. Which is why the OS does memory management and preemptive multitsking. Perfect? No. Sometimes (ex., when running multiple instances of 3DS MAX in the background) I can get better performance by setting CPU affinity and priority manually, and I wish the OS also let me set how much RAM a given process is allowed to use. But even the OS's automatic management is better than having software that leaves resources unused (limiting its own performance) because it decides you might want to run something else. Applications should worry abouyt themselves; let the OS balance things between them.
People keep looking at memory usage (and CPU usage, for that matter) as if they were running Windows 3.11, and as if "allocating 500 MB" actually meant you now had 500 MB less to run other programs.
You're not one of those who think that the browser is part of the OS are you:-P I vaguely recall Microsoft doing something like this...
Sadly (for them), by adding "part of" they completely missed the boat.
But you don't _know_ the more common situation. People use their computers any way they like, and if they want to do several things at the same time, you simply won't know.
Oh, but I do. There's this wonderful thing called "statistics". You should look into it (though, be warned, 17.43% of them are completely meaningless).
Swapping is no panacea.
There's a lot more to modern memory management than "swapping". For starters, if an application allocates 1 GB but only uses 100 MB, the remaining 900 MB are never actually allocated, in RAM or the pagefile. Modern operating systems are very good at lying to their children.
Well, I would say to assume that most single users are going to do 95% browsing is pretty arrogant in itself.
Learn to read.
By your philosophy, do you tell your users to close their browsers if they want to do any of those other things, preferably one at a time?
No need. I'm running an operating system written in this century, on hardware designed in this century. It can handle "selfish" applications just fine - it tells them they get the toys, then takes them away when they're not looking and returns them as soon as they start reaching for them again.
It's quite simple. The less memory an application uses, the more is left available for some other application that you may want to run at the same time.
Dude, that's a devastating argument, I'm sure no one had ever thought about that before. But wait... what if I don't want to run another memory-intensive program? That means the main program that I am using (in fact, the only one, apart from background OS stuff) is not performing as well as it could, because it decided that I might want to do something that I know I don't want to do.
You might as well argue that there's a benefit in keeping all your files inside 7-Zip archives to save disk space "in case it's necessary for something else".
If only there was some sort of "super-program" that could manage the memory and CPU use of other programs, see which one(s) the user is actually interacting with, and decide who has priority.
But what if you then want to open some Office apps or run a game while the browser is still open? The browser isn't going to suddenly do some internal management [...]
No, the browser probably won't (not suddenly, anyway). But the operating system will. It's called "memory management". And if the browser is smart, it will alter its cache size when the amount of free memory changes (increase the cache when more memory becomes available, reduce it when memory is close to being full).
People are using more and more applications simultaneously, and while the average amount of memory in a PC is also climbing, there's still a benefit in having your programs use as little as possible
Ten years ago your average PC had 128 MB of RAM. Now it comes with ten or twenty times as much. Are you running 40 or 50 applications at the same time? Hell, some home systems these days come with more memory than a single process can even address, let alone use.
Measuring the amount of RAM a process uses is meaningless. A far more relevant test would be how much memory an application requires (i.e., when does it refuse to run at all).
Put that way, you've got a pretty uncontroversial point.
Apparently I don't, because I keep seeing reviews comparing browsers where the browser using less RAM is considered "better" and "more efficient" regardless of how that extra RAM is put to use.
Of course a program should use the memory it requires to comfortably do it's job.
It's its, not it's. Anyway, I have no idea what you mean by "comfortably do its job". Call me an insensitive clod, but I don't care how "comfortable" the program feels. I care how responsive it is. And if using more RAM makes it more responsive, and if that RAM is available, I bloody well expect it to use it (unless I deliberately set a low limit for its cache size, for example).
I seem to recall something about using unused ram for caching etc.
Yes, I believe you'll find that caching falls into the "using more RAM to speed things up" category.
That's an active polling model though, which isn't such a great idea in a multitasking system. It's just less efficient than having the system notify your program when an event of interest occurs.
The system doesn't know what my program considers interesting. Checking the amount of free memory each time you open or close a page is more than enough, and is negligible in terms of performance. If the system wasn't "a multitasking system" there would be no need to check the amount of free RAM (or release any of it) anyway, because the browser would be the only thing running. It is precisely because we're talking about a multitasking environment that the whole thing makes sense.
If your program is actually paged when memory is low, and it receives a slice of cpu time during which it decides to free all that extra memory it has reserved, then the system is going to be swapping all those reserved pages back into RAM, just so that the program can _traverse_ them while deciding what to keep and what to throw away.
Why would the program need to look at the full contents of its cache to decide which parts it doesn't need? All it needs to know is how old each entry is, and that should be kept in a master table. To release it, all it needs to do is destroy a given block. It's up to the OS to handle that, and I doubt the OS will bother to load the entire block into RAM; it'll simply mark it as unallocated in its own table (doesn't even need to access the pagefile). Obviously if all the browser's code and data is swapped out, some of it will have to be swapped back into RAM (if it's "getting a slice of CPU time" then that has already been done), but your absolute-worst-case scenario doesn't make any sense in a modern operating system.
Your arguments remind me a bit of the EPIC / IA-64 zealots. Things that look good on paper don't necessarily work well in the real world, and things that seem to make sense when you're running 1 or 2 processes don't necessarily apply when you're running 5 or 10.
If I have eight CPUs and my video encoder can use them to get its job done faster, that's what it should do. It shouldn't use just 4 (or 1, or 7) and leave the rest idle because "they might be necessary for some other process". That's a decision for the operating system, or for me (the user). It's not a decision for the guy who coded the video encoder.
A system that relies on every component behaving "politely" or "cooperatively" is a system that will very easily be brought to its knees when one of those components doesn't (Windows 3.xx anyone?). It's simpler and more practical (both for application coders and end users) to let the OS be the arbiter of who gets what when (RAM, CPU cycles, network packets, disk access, etc.) than to hope that all programs will magically get along. And modern operating systems are designed to deal with "selfish" programs just fine. In fact, running "altruistic" programs generally means you won't be getting the most out of your system, especially if the system is being used interactively.
The OP was arguing that if extra memory is sitting there "unused", the program should reserve it for it's own use lest it be wasted.
No, he wasn't. And I know that beacuse the OP was me. What I wrote (several times already) is that if using extra RAM will translate into a performance benefit, and if the RAM is available, then it is not using it that constitutes "a bad use of resources", and not the other way around.
That's a great idea in theory, but of course programs have to be notified so they can release the memory,
No, they don't. They can regularly monitor the amount of free RAM and scale down (by releasing older / less used cache data) when there is less than a certain amount free. Just as the OS can preemptively page out data when the amount of free memory is low and increase the pagefile so that the next allocation request doesn't fail. This is 2008, memory management in operating systems has evolved a bit.
which they're unlikely to respond to in a timely fashion, especially if they're paged out,
Sigh. If they're paged out then it doesn't matter how much memory they have allocated, because they're not actually in RAM. Do think your examples through.
Well that's nonsense. Do you really know 1) what hardware architecture your program is going to be running on,
In 95% of cases, yes, I do.
2) what exact compiler version and optimization flags is going to be used,
Yup.
3) what operating system will run it?
Absolutely.
I realise that having some connection to the real world might seem odd to you, but, believe it or not, most programmers do know what operating system they're writing software for, how the code will be compiled and what decade the target CPU was designed in.
Some of them even know what language they're coding in and what day of the week it is. Amazing, isn't it?
But, regardless of that, using a XOR swap is a very silly thing to do. In fact, it's especially silly if you don't know the target system. Because, you see, the compiler does know the target system, and will do a much better job than you do, if it understands what you're trying to do (which is swap two variables). If the target system supports register exchanges, it'll use that. One XCHG instruction, instead of three XORs. If it doesn't, it'll use a temporary register variable to do the swap. It's easily parallelizable and, at worst, executes as fast as three XORs on any common architecture (except, of course, in your own theoretical CPU conceived to prove that you're right and everyone coding compilers is wrong).
XOR swaps only make sense if you're hand-coding assembly for a specific platform, have no free registers for that data type, and know that the code wouldn't be parallelizable anyway (or don't care about performance).
Really? Well thanks for telling me, because I had no idea...
Desktop node? What desktop node? My example didn't specify, but if you're asking it was a (hardware) X terminal, I don't recall the make.
Yes, X terminals have local RAM. Or do you think every single RAM access gets sent back and forth to the server?
As to your second point, on my desktop I sometimes have browsers open for weeks,
And always so busy and using so much RAM that the OS can't swap out any of the memory it's using...? You see, memory management in modern operating systems isn't quite as dumb as it was back in 1990.
If by optimizing to the common situation you mean programmers claiming bla bla bla
No, by "optimising for the more common situation" I mean... optimising for the more common situation. Meaning that, if you start the browser and there are 4 GB of RAM free, it's perfectly fine to allocate 200 or 300 MB for cache straight away. And, as you continue to browse, if there are still several GB of free memory, it's perfectly fine to increase the size of the cache if that translates into some tangible benefit. And that means a browser "consuming" 500 MB (to use the article's expression) may in fact be doing a far more efficient use of system resources than a browser "consuming" 10 MB.
To not use availabe RAM based on some archaic philosophy applicable to multi-user UNIX servers from 1990 when you're coding for single-user Windows / Mac / Linux workstations with tons of RAM is not just misguided, it shows a complete lack of respect for the end user. Which is something a lot of programmers suffer from (usually either because they learned to code ages ago or they were taught to code by someone who didn't keep up with the times).
You're right, there's also a possible overflow problem depending on the values of the variables. Try XOR swap for a guaranteed in place algorithm.
Forgot to address this:
Even ignoring the added complexity and destructive potential (ex., XOR swapping a variable with itself will zero it), a XOR swap is also slower than using a temporary variable, in pretty much any superscalar CPU. Optimisations that made sense in 1980 (and maybe even in 1990) are not just unnecessry today; in many cases they are counter-productive.
Actually, that's not such a bad idea in principle:) There's no reason why a browser should handle the low level details of caching, history databases, logging etc. all itself. Of course in practice a given target system may not actually offer all those particular services in a convenient API.
The "API" to render pages, cache the resulting bitmaps, associate window regions with DOM elements, handle authentication and encryption, etc., is the browser.
You've never shared an account on a busy Unix server, have you? Nothing teaches politeness like having the admin nuke one's process three days into a five day run because it uses too much memory
I have actually. Two problems with your "example": First, the browser uses the RAM on the desktop node, not the server's (at most it'll use the server for disk cache). Second, how often do you run a browser for five days straight (with so much activity that the OS can't even swap any of it out)?
Your idea only makes sense if your PC's single most important task is giving you a great browsing experience,
When the browser is the foreground application on a desktop system? You bet.
which might be the case for you but is no way to do software engineering.
I see. So, in your opinion, "the way to do software engineering" is not to optimise for the most common situation, but rather for the 1% of users that load tons and tons of pages into their browser while not actually looking at it (and thus don't need interface responsiveness)? Or maybe for the "masochist geek" demographic, that enjoys slow screen redraws, unresponsive applications, and full browser crashes caused by a single tab, secure in the knowledge that they have several GB of unused RAM waiting in case some program suddenly needs them and can't wait for the OS to page out old stuff.
I really, really hope you're not a software engineer.
Maybe because you want to run a second application, and want to have some free memory to run it?
When the second application wants to run, it will request memory. The OS will page out parts of the first application's memory pool that haven't been used in a while. If the first application is smart, it will regularly check the amount of free RAM and release non-essential memory if it notices there isn't much left (this isn't about being "nice" - it will actually perform better if it minimises paging).
Obviously if an application using 2 GB performs exactly the same as another using 100 MB, the latter is more efficient. But if using more RAM can speed up things, and if there is plenty of free RAM, it makes absolutely no sense not to use it. And it makes even less sense to consider that an application that uses X MB is "better" or "more efficient" than another that uses 2X MB without taking every aspect of its performance into account. As I wrote above, on a PC I'll gladly trade 100 MB of RAM for a 10% increase in interactive performance.
It's evil for programs to use more memory than they need.
So every browser should basically use only enough memory to load its own executable plus the page source? Everything else can be rendered directly to video memory. It means page redraws, history navigation, scrolling, etc., will all be painfully slow, but hey, objectively the browser doesn't need to cache anything.
It betrays an 80s PC mentality on the part of the programmers.
I keep remembering an "exercise" that at least 3 programming teachers forced me to make, which was to swap the value of two variables without using a third variable:
A = A+B B = A-B A = A-B
Which is fine as a mental exercise, but the problem is at least two of those three teachers actually thought this was faster and used less memory than doing it in two steps with a temporary variable.
That could actually have made some sense in the 80s (where some systems had support for a limited number of variables), but sadly this was well into the 90s.
It's a lot more polite if programs use resources sparingly.
It's a lot more polite that my browser gives me the best possible browsing experience instead of deciding not to use the resources that I'm making available to it. Most browsers let you set a limit to their cache size anyway.
Again, there's a difference between needing a lot of RAM (i.e., not being able to run if there are only a few MB available) and using more RAM (if it's available) to improve the user experience.
Memory allocation and management in modern operating systems is a bit more complicated than that.
Anyway, using your example, if the first program was allowed to allocate 75% of all memory (ex., 1.5 out of 2 GB), that only leaves 25% (0.5 GB), so the second program can't allocate another "75% of all memory" (it'll get an "out of memory" error from the OS). It can, of course, allocate 75% of available memory, meaning it will get 375 MB.
Then, since there is very little RAM left, the OS will try to swap out memory pages that aren't being used, so if you don't use program A, most of it will get swapped out. If and when program B checks the amount of free memory again, it might try to allocate more (if it has any use for it - if not, the OS will fake it, accepting the request for RAM but not actually reserving any).
Now, if the OS is configured to increase the pagefile size and if you have two programs that constantly try to allocate more RAM, and keep accessing all the pages, you can run into a situation where there simply isn't enough physical RAM, and where things keep getting swapped back and forth (meaning your memory becomes as slow as your storage).
In that (pretty rare) situation, you have two options: limit the pagefile size (or turn it off entirely), or buy more RAM.
Enough with the stupid "memory consumption" pseudo-benchmarks. It doesn't "consume" your memory, it uses it. If I have 2 or 4 or 8 GB sitting there, why would I want my software to not use it? What do I possibly gain by having a program that uses only 100 MB when it could be using 1 GB to keep more rendered pages in memory (and speed up the display when I hit "back" a couple of times), for example?
If the browser refuses to run with less than, X MB available (ex., less than 30 MB), that can be a problem. But if it simply uses memory that would otherwise just be sitting there, how is that a relevant (or negative) thing?
I keep remembering that article where someone from the Mozilla foundation said very proudly that Firefox used less memory than Opera (on Windows), making it "superior". But when you look at situations where memory really matters, you find that you can run Opera on pretty much any cellphone but you can't run Firefox. There's a difference between using less memory and needing less memory.
On a PC, I'll trade 100 MB for a 10% speed increase (in page drawing, tab switching, etc.) any day. One of the reasons I like Opera is that (since years ago) it keeps rendered copies of the previous pages in memory, plus a ful index of your e-mail, so you have instant page flips, instant mail searches, etc..
I'll take smartass over dumbass any day, Mr. Anonymous Coward.
Unless you're talking about "converting" the bacteria into something useful (ex., something that can be used to selectively kill other types of bacteria, or do some kind of useful work inside the human body), I'd say that any resources put into trying to shape the "evolution" of a given type of (harmful) bacteria would be much better applied simply finding ways to kill it.
Simply creating a new strain of bacteria doesn't magically make existing strains disappear. You can domesticate one tiger but, unless you kill all the wild ones, you're still at risk if you take a stroll through the jungle.
You're mostly right, but not entirely. The difference is that with simple forms of life, such as bacteria, their DNA copying process isn't as error-free as ours (and even ours isn't 100% error free). So every time they divide, a number of mutations occur.
And how does that contradict any of what I wrote? I kind of assumed that the average Slashdot reader is aware of the fact that random mutations occur (and not just during division / reproduction, although that's the most likely moment). Did I walk into a creationist website by mistake?
If one of those mutations end up giving them some resistance to the antibiotic, that strain is going to dominate
It's not hard to "dominate" when you happen to be resistant or immune to a poison that has killed or is killing everyone round you. But it's not the antibiotic that grants the bacteria the resistance (that would be kind of counter-productive). If they are not resistant to it at the time when they are exposed, they die (or become unable to reproduce and then die, or whatever). The antibiotic simply changes the balance of different bacterial strains.
Using language like "bacteria exposed to this antibiotic might grow a resistance" misleads people into thinking that bacteria have some kind of "immune system", capable of learning from the challenges it is faced with, which is simply not true. A lot of people actually think that every time you take antibiotics, the bacteria in your body "get stronger" (yes, I know it's a ridiculous notion, but ask around - you'll be amazed). And part of the reason for that is this kind of language.
However, if there's no environmental pressure, there's no guarantee that particular mutation will be successful
The concept of "successful" or "unsuccessful" only makes sense when evaluated against environmental pressures (whether from an antibiotic or simply from competition against other strains / genera of bacteria).
My problem (in case it's still not clear) is with language that suggests that exposure to an antibiotic "makes bacteria stronger". It doesn't. It makes most of them dead. It's just that all that death happens to leave an opening for the ones that weren't affected by the antibiotic. But even those don't "get stronger" (they were already "stronger", if by "stronger" you mean "more resistant to this particular challenge"), they simply get a chance to increase in number, by filling the space freed by the death of the other (less lucky) strains.
Let's not attribute deliberative (self) improvement ("learning to resist the antibiotic and becoming stronger") to what is a process of environmental selection. Otherwise we might as well march happily into the dead end of "intelligent design".
It is fine to use the shorthand "grow a greater resistance" to explain the behavior of the strain's evolution. [...] s/he used a layman-accessible shorthand.
I disagree. I don't think it is fine, because "laymen" will interpret that as "bacteria that have contact with an antibiotic will learn how to resist it". Ask around and you'll find that most people belive this. That is, after all, how our immune system works, and how humans (and other complex life forms) deal with challenges.
They don't understand the difference between individual bacteria adaptation ("bacteria growing a resistance") - which doesn't really happen - and strain evolution through (random) mutation and environmental selection (followed by multiplication).
So, when most people are ignorant and when most journalists are ignorant, one would hope that at least the scientists would make an effort to use language that is correct, even if it requires an IQ above 85 (or the ability to open a book and read a couple of pages) to understand. Using "simplified" language that is misleading or plain wrong might get through to more people but achieves the opposite of what it should. In this case, it reinforces people's perception of a selective process as an adaptative process (at the individual organism level). And then they wonder why people fall for nonsense like creationism and intelligent design.
Hell, most people don't even know the real name of Darwin's theory. Calling it "evolution" is missing the point. I guess it's "simpler" than "natural selection" (two words - double the complexity!), although "evolution" just means "change over time" and "natural selection" sums up the actual process.
I think I'm going to eat some cheese.
So we get bacteria who adapt to live in conditions that are totally unlike the conditions inside a human body.
It's really not a matter of what "conditions inside the human body" are like. Conditions inside the human body don't normally include the presence of vast amounts of amoxicillin, for example. And yet, when you have a bacterial infection, taking amoxicillin tablets will get rid of them for you.
Bacteria that aren't "adapted to the conditions inside the human body" aren't a threat to begin with, so they're irrelevant. The problem with antibiotic resistance is that, if you wipe out 99% of bacteria, leaving only the 1% that are resistant to that antibiotic, when those multiply to fill the space left by the ones you killed, you have as many bacteria as you started with, but now your antibiotic is useless.
Not that the arguments in TFA make much sense, mind you, but saying that bacterial resistance is only an issue if they're "adapting to conditions inside the human body" is missing the point. Normal conditions inside the human body don't include antibiotic drugs.
A researcher [...] pointed out the problem [...]: "[A]nything that survives and sticks around grows greater resistance"
If those were his words, then I guess this "researcher" needs to do a bit more research, perhaps starting with a book written by a certain "Charles Darwin".
If the bacteria "stick around" it's because they are already resistant. Meaning they get to multiply, not to "grow greater resistance" (if they survived, their resistance is as "great" as it needs to be).
All that antibiotics do (in the long run) is change the relative populations of different kinds of bacteria (eliminating the ones that aren't resistant, leaving more room and resources for the resistant ones to grow). They don't actively make bacteria "get stronger", as the quote suggests. It's not as if the bacteria send a sample of the antibiotic to their underground lab where bacterial boffins come up with an antidote. They don't even have proper immune systems.
It's annoying when even "scientists" attribute some sort of "guiding intelligence" to the process of natural selection (or to individual bacteria, for that matter).
P.S. - And yes, I'm aware of plasmids, but bacteria can't suddenly rush out to buy some when they need them [ * ], so it's still a matter of selection, not "self-improvement".
[ * ] Unless they're playing Bioshock.
I really wish I could tell the browser to trim down its damn working set
There is: close the browser before you embark on "a lot of non-stop play". ;-)
I'll look for that setting in Opera.
You can even turn caching completely off. Or turn just the memory cache off, and let the OS decide which parts of the disk cache to keep in RAM.
only 68 molecular building blocks are used to construct these four fundamental components of cells
In other news, Microsoft is only interested in controlling two areas of digital computing: the zeros and the ones.
It's not RAM manufacturers, it's the whole computer industry...
No, it isn't. Kilo (k) means "multiplied by one thousand", Mega (M) means "multiplied by one million", and so on. The prefix is part of the SI and means the same in every field of science and engineering. It's only (some) software and RAM manufacturers that get it wrong, basically because they decided 1024 was "close enough" to 1000 to be called "kilo", and then the error added up when using bigger values.
Hard disks use the correct factor, and so do network connections, most optical discs, streaming video bitrates, CPU clock speeds, and so on.
If you want to use the 1024 factor, just use ki, Mi, Gi, and so on (personally I preferred the k2, M2, G2 prefixes, but they didn't catch on - I guess the guys at the IEC love saying kibi-mebi-gibi).
alt-tab between it and Photoshop without spending 10 seconds thrashing the page file every time.
When was the last time, in the past 4 or 5 years, that you spent ten seconds (or even five) switching between a browser and Photoshop? It simply doesn't happen anymore (and note that I have a browser open 24/7 and run photoshop about 8 hours a day, frequently with images over 4k x 4k). You're more likely to have to wait for Photoshop to switch between two large images, but that's because Photoshop's own virtual memory management isn't terribly smart.
Oh, and Opera lets you set limits for both disk and memory cache. Not that it's particularly useful; I generally leave the memory cache set to "auto"; it will monitor free memory and decide how much to use (it rarely uses more than 200 MB, but maybe that's because I rarely visit pages with huge amounts of data).
In any case, even if your browser has 2 GB of memory allocated, it's extremely unlikely it will actually be using all of it at the same time, and the less used parts will eventually get swapped out by the OS.
while the software *might* be able to tell how much physical RAM is available, it has no way of knowing how much of that it is OK to take.
Just as it has no way of knowing how many CPU cycles it's okay to take. Which is why the OS does memory management and preemptive multitsking. Perfect? No. Sometimes (ex., when running multiple instances of 3DS MAX in the background) I can get better performance by setting CPU affinity and priority manually, and I wish the OS also let me set how much RAM a given process is allowed to use. But even the OS's automatic management is better than having software that leaves resources unused (limiting its own performance) because it decides you might want to run something else. Applications should worry abouyt themselves; let the OS balance things between them.
People keep looking at memory usage (and CPU usage, for that matter) as if they were running Windows 3.11, and as if "allocating 500 MB" actually meant you now had 500 MB less to run other programs.
You're not one of those who think that the browser is part of the OS are you :-P I vaguely recall Microsoft doing something like this...
Sadly (for them), by adding "part of" they completely missed the boat.
But you don't _know_ the more common situation. People use their computers any way they like, and if they want to do several things at the same time, you simply won't know.
Oh, but I do. There's this wonderful thing called "statistics". You should look into it (though, be warned, 17.43% of them are completely meaningless).
Swapping is no panacea.
There's a lot more to modern memory management than "swapping". For starters, if an application allocates 1 GB but only uses 100 MB, the remaining 900 MB are never actually allocated, in RAM or the pagefile. Modern operating systems are very good at lying to their children.
Well, I would say to assume that most single users are going to do 95% browsing is pretty arrogant in itself.
Learn to read.
By your philosophy, do you tell your users to close their browsers if they want to do any of those other things, preferably one at a time?
No need. I'm running an operating system written in this century, on hardware designed in this century. It can handle "selfish" applications just fine - it tells them they get the toys, then takes them away when they're not looking and returns them as soon as they start reaching for them again.
It's quite simple. The less memory an application uses, the more is left available for some other application that you may want to run at the same time.
Dude, that's a devastating argument, I'm sure no one had ever thought about that before. But wait... what if I don't want to run another memory-intensive program? That means the main program that I am using (in fact, the only one, apart from background OS stuff) is not performing as well as it could, because it decided that I might want to do something that I know I don't want to do.
You might as well argue that there's a benefit in keeping all your files inside 7-Zip archives to save disk space "in case it's necessary for something else".
If only there was some sort of "super-program" that could manage the memory and CPU use of other programs, see which one(s) the user is actually interacting with, and decide who has priority.
But what if you then want to open some Office apps or run a game while the browser is still open? The browser isn't going to suddenly do some internal management [...]
No, the browser probably won't (not suddenly, anyway). But the operating system will. It's called "memory management". And if the browser is smart, it will alter its cache size when the amount of free memory changes (increase the cache when more memory becomes available, reduce it when memory is close to being full).
People are using more and more applications simultaneously, and while the average amount of memory in a PC is also climbing, there's still a benefit in having your programs use as little as possible
Ten years ago your average PC had 128 MB of RAM. Now it comes with ten or twenty times as much. Are you running 40 or 50 applications at the same time? Hell, some home systems these days come with more memory than a single process can even address, let alone use.
Measuring the amount of RAM a process uses is meaningless. A far more relevant test would be how much memory an application requires (i.e., when does it refuse to run at all).
Put that way, you've got a pretty uncontroversial point.
Apparently I don't, because I keep seeing reviews comparing browsers where the browser using less RAM is considered "better" and "more efficient" regardless of how that extra RAM is put to use.
Of course a program should use the memory it requires to comfortably do it's job.
It's its, not it's. Anyway, I have no idea what you mean by "comfortably do its job". Call me an insensitive clod, but I don't care how "comfortable" the program feels. I care how responsive it is. And if using more RAM makes it more responsive, and if that RAM is available, I bloody well expect it to use it (unless I deliberately set a low limit for its cache size, for example).
I seem to recall something about using unused ram for caching etc.
Yes, I believe you'll find that caching falls into the "using more RAM to speed things up" category.
That's an active polling model though, which isn't such a great idea in a multitasking system. It's just less efficient than having the system notify your program when an event of interest occurs.
The system doesn't know what my program considers interesting. Checking the amount of free memory each time you open or close a page is more than enough, and is negligible in terms of performance. If the system wasn't "a multitasking system" there would be no need to check the amount of free RAM (or release any of it) anyway, because the browser would be the only thing running. It is precisely because we're talking about a multitasking environment that the whole thing makes sense.
If your program is actually paged when memory is low, and it receives a slice of cpu time during which it decides to free all that extra memory it has reserved, then the system is going to be swapping all those reserved pages back into RAM, just so that the program can _traverse_ them while deciding what to keep and what to throw away.
Why would the program need to look at the full contents of its cache to decide which parts it doesn't need? All it needs to know is how old each entry is, and that should be kept in a master table. To release it, all it needs to do is destroy a given block. It's up to the OS to handle that, and I doubt the OS will bother to load the entire block into RAM; it'll simply mark it as unallocated in its own table (doesn't even need to access the pagefile). Obviously if all the browser's code and data is swapped out, some of it will have to be swapped back into RAM (if it's "getting a slice of CPU time" then that has already been done), but your absolute-worst-case scenario doesn't make any sense in a modern operating system.
Your arguments remind me a bit of the EPIC / IA-64 zealots. Things that look good on paper don't necessarily work well in the real world, and things that seem to make sense when you're running 1 or 2 processes don't necessarily apply when you're running 5 or 10.
If I have eight CPUs and my video encoder can use them to get its job done faster, that's what it should do. It shouldn't use just 4 (or 1, or 7) and leave the rest idle because "they might be necessary for some other process". That's a decision for the operating system, or for me (the user). It's not a decision for the guy who coded the video encoder.
A system that relies on every component behaving "politely" or "cooperatively" is a system that will very easily be brought to its knees when one of those components doesn't (Windows 3.xx anyone?). It's simpler and more practical (both for application coders and end users) to let the OS be the arbiter of who gets what when (RAM, CPU cycles, network packets, disk access, etc.) than to hope that all programs will magically get along. And modern operating systems are designed to deal with "selfish" programs just fine. In fact, running "altruistic" programs generally means you won't be getting the most out of your system, especially if the system is being used interactively.
The OP was arguing that if extra memory is sitting there "unused", the program should reserve it for it's own use lest it be wasted.
No, he wasn't. And I know that beacuse the OP was me. What I wrote (several times already) is that if using extra RAM will translate into a performance benefit, and if the RAM is available, then it is not using it that constitutes "a bad use of resources", and not the other way around.
That's a great idea in theory, but of course programs have to be notified so they can release the memory,
No, they don't. They can regularly monitor the amount of free RAM and scale down (by releasing older / less used cache data) when there is less than a certain amount free. Just as the OS can preemptively page out data when the amount of free memory is low and increase the pagefile so that the next allocation request doesn't fail. This is 2008, memory management in operating systems has evolved a bit.
which they're unlikely to respond to in a timely fashion, especially if they're paged out,
Sigh. If they're paged out then it doesn't matter how much memory they have allocated, because they're not actually in RAM. Do think your examples through.
Well that's nonsense. Do you really know 1) what hardware architecture your program is going to be running on,
In 95% of cases, yes, I do.
2) what exact compiler version and optimization flags is going to be used,
Yup.
3) what operating system will run it?
Absolutely.
I realise that having some connection to the real world might seem odd to you, but, believe it or not, most programmers do know what operating system they're writing software for, how the code will be compiled and what decade the target CPU was designed in.
Some of them even know what language they're coding in and what day of the week it is. Amazing, isn't it?
But, regardless of that, using a XOR swap is a very silly thing to do. In fact, it's especially silly if you don't know the target system. Because, you see, the compiler does know the target system, and will do a much better job than you do, if it understands what you're trying to do (which is swap two variables). If the target system supports register exchanges, it'll use that. One XCHG instruction, instead of three XORs. If it doesn't, it'll use a temporary register variable to do the swap. It's easily parallelizable and, at worst, executes as fast as three XORs on any common architecture (except, of course, in your own theoretical CPU conceived to prove that you're right and everyone coding compilers is wrong).
XOR swaps only make sense if you're hand-coding assembly for a specific platform, have no free registers for that data type, and know that the code wouldn't be parallelizable anyway (or don't care about performance).
Which part of "if you have several GB sitting there" don't you understand?
Even if for some reason that sentence didn't register, one would expect that this one would clear things up:
"There's a difference between using less memory and needing less memory."
Apparently the ability to read is too resource-intensive for some people.
That's not an API.
Really? Well thanks for telling me, because I had no idea...
Desktop node? What desktop node? My example didn't specify, but if you're asking it was a (hardware) X terminal, I don't recall the make.
Yes, X terminals have local RAM. Or do you think every single RAM access gets sent back and forth to the server?
As to your second point, on my desktop I sometimes have browsers open for weeks,
And always so busy and using so much RAM that the OS can't swap out any of the memory it's using...? You see, memory management in modern operating systems isn't quite as dumb as it was back in 1990.
If by optimizing to the common situation you mean programmers claiming bla bla bla
No, by "optimising for the more common situation" I mean... optimising for the more common situation. Meaning that, if you start the browser and there are 4 GB of RAM free, it's perfectly fine to allocate 200 or 300 MB for cache straight away. And, as you continue to browse, if there are still several GB of free memory, it's perfectly fine to increase the size of the cache if that translates into some tangible benefit. And that means a browser "consuming" 500 MB (to use the article's expression) may in fact be doing a far more efficient use of system resources than a browser "consuming" 10 MB.
To not use availabe RAM based on some archaic philosophy applicable to multi-user UNIX servers from 1990 when you're coding for single-user Windows / Mac / Linux workstations with tons of RAM is not just misguided, it shows a complete lack of respect for the end user. Which is something a lot of programmers suffer from (usually either because they learned to code ages ago or they were taught to code by someone who didn't keep up with the times).
You're right, there's also a possible overflow problem depending on the values of the variables. Try XOR swap for a guaranteed in place algorithm.
Forgot to address this:
Even ignoring the added complexity and destructive potential (ex., XOR swapping a variable with itself will zero it), a XOR swap is also slower than using a temporary variable, in pretty much any superscalar CPU. Optimisations that made sense in 1980 (and maybe even in 1990) are not just unnecessry today; in many cases they are counter-productive.
Actually, that's not such a bad idea in principle :) There's no reason why a browser should handle the low level details of caching, history databases, logging etc. all itself. Of course in practice a given target system may not actually offer all those particular services in a convenient API.
The "API" to render pages, cache the resulting bitmaps, associate window regions with DOM elements, handle authentication and encryption, etc., is the browser.
You've never shared an account on a busy Unix server, have you? Nothing teaches politeness like having the admin nuke one's process three days into a five day run because it uses too much memory
I have actually. Two problems with your "example": First, the browser uses the RAM on the desktop node, not the server's (at most it'll use the server for disk cache). Second, how often do you run a browser for five days straight (with so much activity that the OS can't even swap any of it out)?
Your idea only makes sense if your PC's single most important task is giving you a great browsing experience,
When the browser is the foreground application on a desktop system? You bet.
which might be the case for you but is no way to do software engineering.
I see. So, in your opinion, "the way to do software engineering" is not to optimise for the most common situation, but rather for the 1% of users that load tons and tons of pages into their browser while not actually looking at it (and thus don't need interface responsiveness)? Or maybe for the "masochist geek" demographic, that enjoys slow screen redraws, unresponsive applications, and full browser crashes caused by a single tab, secure in the knowledge that they have several GB of unused RAM waiting in case some program suddenly needs them and can't wait for the OS to page out old stuff.
I really, really hope you're not a software engineer.
Maybe because you want to run a second application, and want to have some free memory to run it?
When the second application wants to run, it will request memory. The OS will page out parts of the first application's memory pool that haven't been used in a while. If the first application is smart, it will regularly check the amount of free RAM and release non-essential memory if it notices there isn't much left (this isn't about being "nice" - it will actually perform better if it minimises paging).
Obviously if an application using 2 GB performs exactly the same as another using 100 MB, the latter is more efficient. But if using more RAM can speed up things, and if there is plenty of free RAM, it makes absolutely no sense not to use it. And it makes even less sense to consider that an application that uses X MB is "better" or "more efficient" than another that uses 2X MB without taking every aspect of its performance into account. As I wrote above, on a PC I'll gladly trade 100 MB of RAM for a 10% increase in interactive performance.
You really need to read a bit about how modern operating systems manage memory.
It's evil for programs to use more memory than they need.
So every browser should basically use only enough memory to load its own executable plus the page source? Everything else can be rendered directly to video memory. It means page redraws, history navigation, scrolling, etc., will all be painfully slow, but hey, objectively the browser doesn't need to cache anything.
It betrays an 80s PC mentality on the part of the programmers.
I keep remembering an "exercise" that at least 3 programming teachers forced me to make, which was to swap the value of two variables without using a third variable:
A = A+B
B = A-B
A = A-B
Which is fine as a mental exercise, but the problem is at least two of those three teachers actually thought this was faster and used less memory than doing it in two steps with a temporary variable.
That could actually have made some sense in the 80s (where some systems had support for a limited number of variables), but sadly this was well into the 90s.
It's a lot more polite if programs use resources sparingly.
It's a lot more polite that my browser gives me the best possible browsing experience instead of deciding not to use the resources that I'm making available to it. Most browsers let you set a limit to their cache size anyway.
Again, there's a difference between needing a lot of RAM (i.e., not being able to run if there are only a few MB available) and using more RAM (if it's available) to improve the user experience.
I was talking about web browsers. Not worm APIs. ;-)
Tell your boss he can download a fix for his problems at several websites (ex., mozilla.com, opera.com, etc.)
Memory allocation and management in modern operating systems is a bit more complicated than that.
Anyway, using your example, if the first program was allowed to allocate 75% of all memory (ex., 1.5 out of 2 GB), that only leaves 25% (0.5 GB), so the second program can't allocate another "75% of all memory" (it'll get an "out of memory" error from the OS). It can, of course, allocate 75% of available memory, meaning it will get 375 MB.
Then, since there is very little RAM left, the OS will try to swap out memory pages that aren't being used, so if you don't use program A, most of it will get swapped out. If and when program B checks the amount of free memory again, it might try to allocate more (if it has any use for it - if not, the OS will fake it, accepting the request for RAM but not actually reserving any).
Now, if the OS is configured to increase the pagefile size and if you have two programs that constantly try to allocate more RAM, and keep accessing all the pages, you can run into a situation where there simply isn't enough physical RAM, and where things keep getting swapped back and forth (meaning your memory becomes as slow as your storage).
In that (pretty rare) situation, you have two options: limit the pagefile size (or turn it off entirely), or buy more RAM.
Enough with the stupid "memory consumption" pseudo-benchmarks. It doesn't "consume" your memory, it uses it. If I have 2 or 4 or 8 GB sitting there, why would I want my software to not use it? What do I possibly gain by having a program that uses only 100 MB when it could be using 1 GB to keep more rendered pages in memory (and speed up the display when I hit "back" a couple of times), for example?
If the browser refuses to run with less than, X MB available (ex., less than 30 MB), that can be a problem. But if it simply uses memory that would otherwise just be sitting there, how is that a relevant (or negative) thing?
I keep remembering that article where someone from the Mozilla foundation said very proudly that Firefox used less memory than Opera (on Windows), making it "superior". But when you look at situations where memory really matters, you find that you can run Opera on pretty much any cellphone but you can't run Firefox. There's a difference between using less memory and needing less memory.
On a PC, I'll trade 100 MB for a 10% speed increase (in page drawing, tab switching, etc.) any day. One of the reasons I like Opera is that (since years ago) it keeps rendered copies of the previous pages in memory, plus a ful index of your e-mail, so you have instant page flips, instant mail searches, etc..