Wednesday, June 13, 2012

e-MMC (Embedded MultiMedia Card)

     eMMC describes an architecture consisting of an embedded storage solution with MMC interface, flash memory and controller.In one line it is a flash/nand over MMC interface. Typically, flash memory is controlled by a dedicated controller that supervises data reads and writes, and operates under the control of the application's CPU.

     eMMC is a standard for embedded memory devices that contain not only a data storage element (such as NAND flash memory), but also a controller for the storage element integrated on the same silicon die. This results in several advantages, such as reduced development time and easier integration of the memory block in the overall system. Ultimately, this leads to a much shorter time-to-market for the end product.



  e·MMC embedded memory essentially transforms a program/erase/read device like NAND Flash into a simple write/read memory. This managed interface addresses potential NAND design concerns internally, using error correction code (ECC), wear leveling, and bad block management technology. Handling errors internally takes the burden off the host controller and increases speed, providing higher system performance.Managed NANDs are RAW NANDs combined with a memory controller and can support popular interfaces such as MMC (eMMC, moviNAND), SD (eSD) and SPI. The memory controller hides the details of the NAND and provides the intended interface and ECC support. This means that a eMMC/eSD NAND can talk to a embedded TI device through MMC/SD controller.

Composition of an e-MMC System
An e-MMC system generally consists of a host controller, an e-MMC device, and a HS-MMC driver, which is software that controls the e-MMC (see below).

  1. The host controller has a host CPU and a HS-MMC interface. The e-MMC also has a HS-MMC interface.
  2. The e-MMC consists of raw MLC NAND flash memory and a controller. The controller has a HS-MMC interface which can be connected to the host controller. It also has a NAND interface which is connected to the raw MLC NAND flash memory. It has several functions such as bad block management, wear leveling and error correction code (ECC), to utilize the raw MLC NAND flash memory efficiently.
  3. The HS-MMC driver handles operations between the host controller and the e-MMC.

Sunday, June 10, 2012

Monday, May 14, 2012

CPU Load Calculation

In Unix computing, the system load is a measure of the amount of work that a computer system performs.
  The most common tools are  uptime, procinfo, w(ho), top. among which top covers pretty much. so lets stick to top
$top
The Unix and Linux top command shows memory and cpu use
    As you can see
  • Line 1 “top”, indicates that the system has been up and running for 171 days.
  • Line 2 “Tasks”, displays the total number of processes along with a breakdown of running, sleeping, stopped and zombie processes count. 
  • it takes values from /proc/stat.
  • the first /proc/stat line shows like this at t0
    cpu user nice system idle iowait irq softirq (dont know)
    cpu 736324 49874 581102 298162832 3012015 120311 0 0
    a few seconds later (t1):
    cpu 736334 49874 581102 298162971 3012015 120311 0 0
    differences:
    cpu 10 0 0 139 0 0 0 0
    all numbers together at t0 are: 302662458
    a few seconds later (t1): 302662607
    difference (t1-t0): 149

    the difference 149 is 100% cpu time
    so it seems the cpu has spent 93.28% (139 time unit's (seems to be USER_HZ)) in cpu idle
    and 6.72% in user mode
     

    for more detailed description see: http://www.linuxhowtos.org/System/procstat.htm
    as the link describes the values in /proc/stat identify the amount of time the cpu has spent in what kind of "work"

     
  • Line 3 “Cpu(s)” displays the current CPU utilization of the system. In this example, CPU is 98.7% idle
    • here the meaning of each 
    •  us -> User CPU time: The time the CPU has spent running users’ processes that are not niced.
    • sy -> System CPU time: The time the CPU has spent running the kernel and its processes.
    • ni -> Nice CPU time: The time the CPU has spent running users’ proccess that have been niced.
    • wa -> iowait: Amount of time the CPU has been waiting for I/O to complete.
    • hi -> Hardware IRQ: The amount of time the CPU has been servicing hardware interrupts.
    • si -> Software Interrupts.: The amount of time the CPU has been servicing software interrupts. 
    • st -> Time stolen from a virtual machine.
  • Line 4 “Mem” and line 5 “Swap” provides the memory information. This is the same information from the free command.
  • The rest of the lines display all the active processes on the system, sorted default by CPU usage (%CPU column). i.e the most CPU intensive processes will be displayed on the top by default.                                                        PID - The thread ID. This can be converted into hexadecimal and used to correlate to the "native ID" in a javacore.txt file.
    USER - The user ID of the user that started the process.
    PR - The priority of the thread.
    NI - The "nice" value for the process.
    VIRT - The virtual memory (allocated) usage of the process.
    RES - The resident memory (committed) usage of the process.
    SHR - The shared memory usage of the process.
    S - The state of the thread. This can be one of the following:
    R - Running
    S - Sleeping
    D - Uninterruptible sleep
    T - Traced
    Z - Zombie
    %CPU - The percentage of a single CPU usage by the thread.
    %MEM - The percentage of the memory used by the process.
    TIME+ - The amount of CPU time used by the thread.
    COMMAND - The name of the process executable.

  •  top - 16:15:45 up 21 days,  2:27,  3 users,  load   average: 17.94, 12.30, 5.52   
      Tasks: 150 total,  26 running, 124 sleeping,   0   stopped,   0 zombie   
      Cpu(s): 87.3% us,  1.2% sy,  0.0% ni, 27.6% id,  0.0%   wa,  0.0% hi,  0.0% si   
      Mem:   4039848k total,  3999776k used,   40072k free,    92824k buffers   
      Swap:  2097144k total,      224k used, 2096920k free,  1131652k cached 
      PID USER    PR  NI  VIRT  RES  SHR S %CPU   %MEM    TIME+  COMMAND   
      31253 user1   16   0 2112m 2.1g 1764 R 37.0   53.2   0:39.89 java   
      31249 user1   16   0 2112m 2.1g 1764 R 15.5   53.2   0:38.29 java   
      31244 user1   16   0 2112m 2.1g 1764 R 13.6   53.2   0:40.05 java   
      31250 user1   16   0 2112m 2.1g 1764 R 13.6   53.2   0:41.23 java   
      31242 user1   16   0 2112m 2.1g 1764 R 12.9   53.2   0:40.56 java   
      31238 user1   16   0 2112m 2.1g 1764 S 12.6   53.2   1:22.21 java   
      31246 user1   16   0 2112m 2.1g 1764 R 12.6   53.2   0:39.62 java   
      31248 user1   16   0 2112m 2.1g 1764 R 12.6   53.2   0:39.40 java   
      31258 user1   16   0 2112m 2.1g 1764 R 12.6   53.2   0:39.98 java   
      31264 user1   17   0 2112m 2.1g 1764 R 12.6   53.2   0:39.54 java   
      31243 user1   16   0 2112m 2.1g 1764 R 12.2   53.2   0:37.43 java   
      31245 user1   16   0 2112m 2.1g 1764 R 12.2   53.2   0:37.53 java   
      31255 user1   16   0 2112m 2.1g 1764 R 11.9   53.2   0:40.84 java   
      31265 user1   16   0 2112m 2.1g 1764 R 11.9   53.2   0:40.46 java   
      31239 user1   16   0 2112m 2.1g 1764 S 11.6   53.2   1:22.79 java   
      31254 user1   16   0 2112m 2.1g 1764 R 11.6   53.2   0:41.12 java   
      31266 user1   16   0 2112m 2.1g 1764 R 11.2   53.2   0:40.47 java   
      31261 user1   16   0 2112m 2.1g 1764 R 10.9   53.2   0:39.31 java   
      31262 user1   16   0 2112m 2.1g 1764 R 10.9   53.2   0:38.50 java    
    



       In the per-thread breakdown of the CPU usage shown above, the java process is taking approximately 75% of the CPU usage. This value is found by totalling the %CPU column for all the Java threads (not all threads are shown above) and dividing by the number of CPUs. The Java process is not limited by other processes, because the CPU there is still approximately 25% idle. You can also see that the CPU usage of the Java process is spread reasonably evenly over all of the threads in the Java process. This spread implies that no one thread has a particular problem. Although the application is allowed to use most of the available CPU, approximately 25% of the total CPU is idle meaning that some points of contention or delay in the Java process can be identified. A report indicating that active processes are using a small percentage of CPU, even though the machine appears idle, means that the performance of the application is probably limited by points of contention or process delay, preventing the application from scaling to use all of the available CPU. If a deadlock is present, the reported CPU usage for the Java process is low or zero. If threads are looping, the Java CPU usage approaches 100%, but a small number of the threads account for all of that CPU time.
  • Line 1 also has load average details. The load average represents the average system load over a period of time. The system load measures the amount of work your system performs. On *x Systems you usually get the 3 numbers representing the average load during the last 1, 5 and 15 minutes. You can also query the current values from the shell with many tools including uptime, w and top. On Linux Systems you can also read /proc/loadavg. The Value itself starts with 0 for an idle computer. Each process using or waiting for CPU increments the load number by 1. Depending on the number of CPUs you can estimate the system usage in percent. With one CPU a load average of 1 means 100% CPU "usage" and a load average of 1.86 means the CPU is overloaded by 86 percent. Just divide by the number of CPUs available to get your percentage. The Load shouldnt exceed the number of CPU's in your system. Technically the load average is the sum of the run queue length and the number of jobs currently running on the CPUs. The load average tries to measure the number of active processes at any time. As a measure of CPU utilization, the load average is simplistic, poorly defined, but far from useless.
Help screen for the Unix and Linux top command





















 The above Fig shows the different options along with top. Consider that there are two basic modes to display load : "IRIX mode" and "Solaris mode". In IRIX mode (Linux default), a load average of 1 means that one CPU is fully loaded ( or 25% of each CPU on a 4 CPU system, etc). In Solaris mode, a load average of 1 means that all CPUs are fully loaded (so it's actually equivalent to "IRIX mode" load divided by CPU count ).
Note that the "Cpu(s)" line in the header of the output shows the percentage usage across all of the available CPUs, whereas the %CPU column represents the percentage usage of a single CPU. For example, on a four-CPU machine the Cpu(s) row will total 100% and the %CPU column will total 400%. We can view each Cpus load separately by toggling '1'
Lets Get Down Deep
     Now let’s go inside the Linux kernel and see what it is doing to generate these load average numbers.
unsigned long avenrun[3];
 
static inline void calc_load(unsigned long ticks)
{
unsigned long active_tasks; /* fixed-point */
628       
static int count = LOAD_FREQ;
count -= ticks;
if (count > 0) {
count += LOAD_FREQ;
active_tasks = count_active_tasks( );
CALC_LOAD(avenrun[0], EXP_1, active_tasks);
CALC_LOAD(avenrun[1], EXP_5, active_tasks);
CALC_LOAD(avenrun[2], EXP_15, active_tasks);
}
}
The countdown is over a LOAD_FREQ of 5 HZ. How often is that?
1 HZ = 100 ticks
5 HZ = 500 ticks
1 tick = 10 milliseconds
500 ticks = 5000 milliseconds (or 5 seconds)

So, 5 HZ means that CALC_LOAD is called every 5 seconds.

Magic NumbersThe function CALC_LOAD is a macro defined in sched.h
extern unsigned long avenrun[]; /* Load averages */

#define FSHIFT 11 /* nr of bits of precision */
#define FIXED_1 (1<
#define LOAD_FREQ (5*HZ) /* 5 sec intervals */
#define EXP_1 1884 /* 1/exp(5sec/1min) as fixed-point */
#define EXP_5 2014 /* 1/exp(5sec/5min) */
#define EXP_15 2037 /* 1/exp(5sec/15min) */

#define CALC_LOAD(load,exp,n) \
load *= exp; \
load += n*(FIXED_1-exp); \
load >>= FSHIFT;
A noteable curiosity is the appearance of those magic numbers: 1884, 2014, 2037. What do they mean? If we look at the preamble to the code we learn,
/*
 * These are the constant used to fake the fixed-point load-average
 * counting. Some notes:
 * - 11 bit fractions expand to 22 bits by the multiplies: this gives
 * a load-average precision of 10 bits integer + 11 bits fractional
 * - if you want to count load-averages more often, you need more
 * precision, or rounding will get you. With 2-second counting freq,
 * the EXP_n values would be 1981, 2034 and 2043 if still using only
 * 11 bit fractions.
 */
These magic numbers are a result of using a fixed-point (rather than a floating-point) representation. For more information 4th Chapter , Neil J. Gunther. "UNIX Load Average – Part 1: How It Works" (pdf). TeamQuest. http://www.teamquest.com/pdfs/whitepaper/ldavg1.pdf. Retrieved 2009-08-12.


so now its clear that the problems with this are
  1. The “load” is not the utilization but the total queue length.
  2. They are point samples of three different time series.
  3. They are exponentially-damped moving averages.
  4. They are in the wrong order to represent trend information.
 It is necessary to consider this if we are trying to do capacity calcs based on these values :P


Friday, April 13, 2012

Open Source Hardware Association

The Open Source Hardware Association is Coming Soon! 
http://www.oshwa.org/

http://blog.makezine.com/2012/04/23/makes-exclusive-interview-with-alicia-gibb-president-of-the-open-source-hardware-association/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+makezineonline+%28MAKE%29&utm_content=Google+Reader

Monday, April 2, 2012

Interesting Fact on Calendar (History)




Here’s an interesting historical fact, that you might probably never knew. Check below pictures. Just go through it.
Take a look at September 1752
cid:image006.png@01CB83F6.D9947610
cid:_2_07E3844407E381F00023BECA652574AB
n i d o k i d o s
 Have you ever seen the calendar for September 1752 ???
If you are working on Unix, please try this out. At $ prompt, type: cal 9 1752
– Surprised ????
cid:image003.gif@01CB6536.A3EBA580
Not only in Unix, you can also search it on Google
 Explanation for what you see:
Isn't the output queer? A month with whole of eleven days missing. This was the time England shifted from Roman Julian Calendar to the Gregorian Calendar, and the King of England ordered those 11 days to be wiped off the face of the month of September of 1752. (What couldn't a King do in those days?!) And yes, the workers worked for 11 days less, but got paid for the entire 30 days. And that's how "Paid Leave" was born. Hail the King !!!
Before that, April was the first Month of the year. Even then, people didn’t agree to use the Roman Julian Calendar and celebrated 1st April as a New Year.
Then the King announced that those who celebrated April as the New Year are fools… (
April Fools…)
History is really interesting, isn’t it !!!

Share Internet from Dongle(Windows)

Once You are connected to internet through your USB dongle, go to
1) Command Prompt and type >nslookup
           nslookup is a command to query ur DNS.Copy & Save the DNS Address
2) Setup a Ad-Hoc Wifi Network
  1. Open the Start Menu.
  2. Click Control Panel.
  3. Click Network and Internet.
  4. Click Network and Sharing Center.
  5. Under Change your networking settings, click Set up a new connection or network.
  6. Select Set up a wireless ad hoc (computer-to-computer) network.
  7. Click on Next twice.
  8. Enter the Network name such as "LogicNetwork".
  9. Select the Security WAP (or WEP).
  10. Enter the Security key or password.
  11. Check Save this network check box.
  12. Click Turn on Internet connection sharing.

3)Setup a Wifi Network with Static IP
     now,
a)To change the computer’s IP address in Windows 7, type network and sharing into the Search box in the Start Menu and select Network and Sharing Center when it comes up.
1start menu
 b)Then when the Network and Sharing Center opens, click on Change adapter settings.







 
 c)Right-click on your wireless adapter and select Properties. (Not the Local Area Connection as in Picture)



In the Wireless connection Properties window highlight Internet Protocol Version 4 (TCP/IPv4) then click the Properties button.

 
 d)Once You get into properties...
           set ur IP address as "192.168.2.1"
           subnet mask as "255.255.255.0"
           default gateway as "192.168.2.1"


 e) and Finally in ur DNS and alternate DNS you need to setup the Address you copied in step 1 (Result of nslookup)

 4) Now you need to Bridge the Connections(Wireless Connection & LAN)
 
A network bridge is software or hardware that connects two or more networks so that they can communicate. You can create only one network bridge on a computer, but one bridge can handle any number of network connections.
  1. Open Network Connections by clicking the Start button Picture of the Start button, clicking Control Panel, clicking Network and Internet, clicking Network and Sharing Center, and then clicking Manage network connections.
  2. Hold down CTRL and select each(Wireless Network Connection and LAN) network connection that you want to add to the bridge.
  3. Right-click one of the selected network connections, and then click Bridge Connections. Administrator permission required If you are prompted for an administrator password or confirmation, type the password or provide confirmation.


 5) Client Setup(phone or other computer)
a) Switch on wifi in ur clinet and get into settings and setup static IP
          IP Address: "192.168.2.X" where x>1 <= 255 Ex: 192.168.2.2
          Subnet as : 255.255.255.0
          gateway :  192.168.2.1 [IP address of computer in which dongle is connected]
           preferred DNS :  whatever DNS address u got in step 1

Save all!! Connections !!
        Now The client devices shd have internet! enabled!!!
          Happy Surfing :)
          
   

          



Sunday, April 1, 2012

Clock Signal

http://www.designcabana.com/knowledge/electrical/electronics/digital/clock/
http://www.pcguide.com/intro/fun/clockClocks-c.html
http://zone.ni.com/devzone/cda/tut/p/id/5535