Symbian OS
read last symbian news on www.newlc.com read last symbian reviews on www.newlc.com
read last symbian tutorial on www.newlc.com read last symbian download on www.newlc.com
19 Oct 2007 - 13:33

Memory

RAM vs. ROM


Memory is used to hold stuff on your devices. Phone numbers, pictures, programs, music files, they all need memory to work. Ignoring old technology no one uses anymore and exotic technology that hasn't been released to the mass market yet, there are two types of memory: RAM and ROM. They're similar in that they both hold stuff. Their main differences involve speed and power.
  1. RAM: very fast, but burns a lot of power.
  2. ROM: much slower, but burns very little power.

Importantly, RAM needs a constant supply of power for it to remember its data. ROM doesn't. In other words, if your batteries die, you'll lose the stuff in RAM, but the stuff in ROM will still be there.

How is it used? Where are the OS and applications? What actually are my CF and SD Cards?

ROM is where stuff is stored. All the programs and the OS that make up the software on the device are stored in ROM. Your data is stored in ROM too. And SD and CF cards are made of ROM. Effectively, your device has an SD card built into it that you can't remove.
RAM is where stuff runs. When you turn on your device, it loads programs from the ROM into the RAM and runs them from the RAM. When you play a song, it loads a bit of the song out of the ROM into the RAM, plays that bit, throws it out, and loads the next bit. When you read an email, it loads the text from ROM into RAM and displays it. When you load the next one, it throws that text out and loads the new text. Go back to the one you just threw out, and it'll load it out of ROM again.
So, by and large, the amount of RAM you have determines how many things you can run at one time. And the amount of ROM you have determines how much of your stuff you can keep around.

How much RAM and ROM do I need?

Because of the way this hardware is made, there are natural amounts of it. Deviations from these amounts are uncommon. Basically, start at 32M and keep doubling. 32M, 64M, 128M, 256M, etc.
A "typical" device will have 64M of RAM. 32M of RAM is very reasonable, especially if the device uses "NOR" ROM (more on that later). Because of the power drain, there are downsides to having "too much" RAM though. And, for that reason, 128M of RAM is unlikely, but may be done for certain "power user" devices.
A "typical" device will have 64M of ROM as well. Other than cost, there's no downside to having more. So, assuming you can afford it, it'll never hurt to pick the model with more ROM. The software that comes on the device takes around 32M.

Is it advantageous to have more RAM always? Or do I loose on something else in return?

Apart from loosing a lot of money on buying more RAM, you loose on certain more parameters like battery life.
You really don't want more than 32MB RAM for a Smartphone device... this will directly and very noticeably increase the cost and decrease the battery life of the device. For point of reference, almost all mobile phones in the market today require 16MB RAM or less to function - RIM Blackberry devices only have 4MB!

What about NAND and NOR then? Which category do they fall into?


These are the two main types of ROM. They're largely used the same way, and everything I've said about ROM is true of both of them. So, for the most part, you don't need to care which kind you've got. But I'll tell you about them anyway.

NOR: Faster to read, slower to write.
NAND: Slower to read, faster to write.

This is all relative. Both are considerably slower than RAM. There's one very important difference in these technologies. NOR lets you do something we call "execute in place" (XIP). Remember what I said before. To run a program, you first load it into RAM, and then you run it from there. NOR lets you run the program directly from the ROM without loading it into RAM first. This means that you can have a system with less RAM. Note that this only works for programs. You can't XIP a picture or an audio file. NAND typically compensates for not being able to XIP with price. (NAND tends to be cheaper.)

Because NAND is faster to write, and NOR is faster to read. The ideal system would have 64M of NOR and 64M of NAND. It would store all the programs in NOR and store all the user data in NAND. Since it would XIP all of the programs, it wouldn't need 64M of RAM and would drop back down to 32M, thus saving power. XIPing also means faster application load times, since you don't have to load the program into RAM before running it. A device like that would rock.

What about SD and CF Cards?

By the way, every SD and CF card is made out of NAND flash. So, no, you can't XIP programs stored on a storage card.

Can we have only NAND and no NOR in a device?



This makes more sense as it is cheaper and a lot of mobile vendors will love to capture the shares of the present market by reducing their prices. But will this work?

This does work, as a NAND memory comes with a SDRAM in-built in the chip package (generally called asMulti-Chip Package (MCP)). This part of RAM contains the core image (we speak about in Symbian).

Is it the program or the OS that senses if a program is stored in NOR or NAND and either run it as XIP or copy to ram and run? Do I need to write the program differently?

There's nothing an app needs to do differently to XIP or not. It's transparent. Our same code runs XIP or not without any changes from us. The OEM decides at ROM creation time which way to go.
We have different ways to create images for this reason as the file system drivers need to be different for NAND and NOR devices, so an image for one won't work on the other.

As a developer’s point of view, nothing comes in between; it is the same application which can run on a RAM as well as ROM. It is only the way you create the image as.

Pros and Cons of NOR (XIP) over NAND

In the XIP model, the NOR memory executes code, and the volatile memory accounts for constantly changing system elements, such as variables, stack, and heat. In the XIP model, the NOR can also provide data and code storage as well.

The advantage of the XIP model is simplicity, but the disadvantage is its dismal write speed. According to SAMSUNG sources, it takes five seconds to write a new phone number into my cell phone, because NOR has dismal write performance. If you are taking pictures or downloading movies, NOR simply doesn’t have the bandwidth to keep up. At best, XIP can move 100 Mbytes of data over the bus.

Advantages of the XIP model are that it is simple and well-understood across multiple system disciplines. So although the cost of NOR is high compared with that of NAND, designing it into a system is easier, thus it typically helps get designs to market faster.

NOR is 30 to 40% more expensive than NAND. A write speed of 150 kbytes is slow for smartphone.

Is this the end of memory modeling, or Moore’s Law continues? What is in Future?

Moore's Law, which states that the number of transistors that can be integrated in a given silicon area doubles about every 18 months, has held true for the past 25 years and experts agree that it will continue to hold in the immediate future.

So, no doubt this is not the end of it, we have lots to come in future which will be cost efficient as well as Performance effective.
The ones lined in the market includes, Samsung’s One-NAND, M-System’s mDOC, Spansion’s ORNAND, Intel’s Hybrid NAND etc.

NOR (Mbytes/Sec)NAND(Mbytes/Sec)One-Nand(Mbytes/Sec)
Read 108 16.2 108
Write 0.14 6.8 8.2
Erase 0.11 64 64

Tutorial posted October 19th, 2007 by indrajit.tapada...

Submitted by twmd on Fri, 2007-10-19 14:28.

Good summary.

A couple of things though

>> Note that this only works for programs. You can't XIP a picture or an audio file
That's not true. XIP is a bit misleading in that it refers to the fact that the NOR is in part of the CPU addressible memory (and so the Program Counter can reside in a NOR address).

If it's CPU addressable it means that the contents can be read like RAM and so doesn't need to be loaded.
This was used to good effect by Symbian by supporting the blitting of MBM bitmaps direct from NOR and also the reading .rsc resource strings direct from a ROM.

One disadvantage of XIP is that it's still much slower than SDRAM and so a beefy CPU can be crippled by slow execution speed - waiting on the NOR for each instruction. For this reason you end up shadowing a lot of CPU intensive code (e.g muiltimedia codecs) in RAM anyway.

>>XIPing also means faster application load times
Again, you have to study it - taking into account the slower XIP. Techniques such as demand paging help to speed up the loading of bloated applications by only loading the pages that are required and then keeping them around if the application is loaded twice in close succession.

Finally, the Samsung OneNand is interesting since it uses NAND internally, and supports XIP by exposing a NOR like address bus connector.
XIP performance is boosted by Internally caching NAND pages in an on chip RAM buffer.
I've not heard of anyone integrating OneNand onto a Symbian device, but it would be great to study the performance on a development board at least.


Submitted by indrajit.tapada... on Fri, 2007-10-19 15:19.

Hai ,

Thanks a lot for clearing the concept of XIP ing in a nit more detail, and I appreciate it, It Corrected my knowledge of XIPing.I am sure readers will get a far better insight about memory..

Regards,


Submitted by rajesh.singh on Sat, 2007-10-20 04:14.

Really a good article on Memory and is very appreciable too.
Thanks.
Rajesh


Submitted by tote on Sat, 2007-10-20 13:34.

Thanks for putting the effort in writing such a lengthy and valuable article about memory-types. However, there are some thing that you did not mention or I "just" disagree with.

First of all, you wrote that ROM is the place where "stuff is stored". That's not the whole picture, I'm afraid. First, there are the memory cards where you can also store "stuff", of course, not all phones accept memory cards (for example, Nokia N91 did not allow that, but had a built-in hard-disk drive instead). Second, operators tend to pre-install some branded applications on C: drive (store stuff at other locations, than ROM), which is a flash-ROM. There is a common characteristic between memory cards and flash-ROM that they both preserve data even if device is switched off and they don't need extra power (by the battery) for that. Finally, you did not mention it, either, that there is a D: drive on Symbian devices, which is a RAM-drive. It's fast to read, but even faster to write. The interesting thing is that you can store files on that drive, I mean explicitly copy files from one location to the RAM-drive is allowed and efficient in terms of how long it takes. The files just simply do not remain there after power down.

Second, it's worth noting that Symbian has recently come out with demand paging support (in SOS 9.5), which means that whenever a program needs to load another binary it will not load the file entirely only that portion of the file that is really needed. For example, programs have loaded the whole DLL so far. Now it becomes possible to load only fraction of a DLL , on demand, and other portions only when they were really needed.

Finally, don't try to explain it to me that I don't need more RAM than 32 MB. You know, my Nokia N95 has 48 MB and it's not enough even for some simple purposes. For example, when I keep browsing multiple pages, then there is usually a certain point, when there is not enough memory for the Browser (it's the only application I launched) and it quits. I happen to know that there is a protection mechanism built into Symbian OS, called memory watchdog, that shuts applications down when OOM situation occurs (applying LRU approach). Nevertheless, Browser is not the only memory-hungry application. For example, I wanted to play with the built-in camera so that I took the sample program from Nokia that let me have insights of how camera API is meant to be used. I was shocked to see that that application "ate" 6(!) MB alone when it started. So you can imagine how much memory left for other purposes, for example, using the camera! Sad So I think it's the right time to answer those questions, requests for more memory, which is one of the most frequently heard complaints about Nokia phones - that they lack memory.

Thanks for this article again!

Best,

Tote


Submitted by indrajit.tapada... on Sat, 2007-10-20 14:05.

Hi Tote,

I appreciate your reply and also giving some clarifications on some stuffs like 32MB RAM is not enough, I agree Nokia devices run out of memory on critical memory driving applications, and possibly engineers are thinking on those part as well.

Ya , I agree I missed out many things , coz the article was too bi by itself, and adding more things would have lost interest to the readers, I am happy that you have added many things what I missed out , and I once again thanks for the reply.

Cheers,
Indrajit


Submitted by Isha on Mon, 2007-10-22 09:27.


Thanks indrajit.tapada for such a nice and an erudite article . Thanks tote also to cover-up the remaining part . Your's job is appreciateable.

Thanks once again.

Regards
Isha


Submitted by Symbian_Neil on Thu, 2007-10-25 13:01.

Very informative...Thanks


Submitted by indrajit.tapada... on Fri, 2007-10-26 03:00.

Thanks For the Comments


Submitted by aml_1989 on Tue, 2008-02-05 17:32.

Hi,

Thanks for the article, very good.

Can someone confirm for me where flash memory fits into all this?

I'm curious, as the N82 has 128MB of RAM and 100MB of Flash. Is this common to have more RAM than other types of memory?
Or was the N82 just a one off...
Or has wikipedia just got the specification table the wrong way round...

Thanks,
Andy.



copyright 2003-2009 NewLC SARL