

{"id":77698,"date":"2020-05-03T10:00:50","date_gmt":"2020-05-03T04:30:50","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=77698"},"modified":"2024-09-09T22:05:05","modified_gmt":"2024-09-09T16:35:05","slug":"android-dalvik-virtual-machine","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/android-dalvik-virtual-machine\/","title":{"rendered":"Working of Dalvik Virtual Machine in Android"},"content":{"rendered":"<p>In this <strong>DataFlair Android article<\/strong>, we\u2019ll read about <strong>Dalvik Virtual Machine(DVM)<\/strong>. Android DDM was written by Dan Bornstein, and Dalvik is the name of a town in Iceland.<\/p>\n<p>A Dalvik virtual machine enables Android applications to run in its own process with its own instance.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/android-dalvik-virtual-machine.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-77742\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/android-dalvik-virtual-machine.jpg\" alt=\"android dalvik virtual machine\" width=\"802\" height=\"420\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/android-dalvik-virtual-machine.jpg 802w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/android-dalvik-virtual-machine-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/android-dalvik-virtual-machine-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/android-dalvik-virtual-machine-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/android-dalvik-virtual-machine-520x272.jpg 520w\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" \/><\/a><\/p>\n<h3>Virtual Machine<\/h3>\n<p>Firstly let us understand what a virtual machine is? It is basically a software implementation of a physical computer. This implementation works like a real physical computer. It even compiles and runs programs the same as a physical computer. It can be understood like an emulator. There are some issues with virtual machines too. One is that it is less efficient when compared to physical computers. Another issue is its performance, which is unstable when multiple virtual machines are working simultaneously on the same machine.<\/p>\n<p>A Virtual Machine simulates the physical hardware of a computer, including CPU, memory and storage.Each VM acts as a separate entity of its own, isolated from other virtual machines if they are running on the same host.They can be configured to use specific amount of storage, RAM and memory from the host computer.<\/p>\n<p>Even though Java Virtual machine has a high performance and provides great memory management, it is not optimized for low-powered devices. Dalvik VM is also a virtual machine that is highly optimized for mobile devices. Thus, it provides all the three things, that are<strong> memory management, high performance as well as battery life<\/strong>. It is strictly developed for Android mobile phones.<\/p>\n<h3>Role of the Dalvik Virtual Machine<\/h3>\n<p>The Dalvik Virtual Machine(DVM) was the original machine which was used by Android and it was replaced by Android RunTime(ART) when Android 5.0 was released. It executed bytecode generated from APK\u2019s, which are compiled from Java source code into Dalvik Executable(DEX) files.<\/p>\n<p>The Role of the DVM in Android includes:<\/p>\n<ul>\n<li>Optimizing the Virtual Machine for memory, battery life, and performance<\/li>\n<li>Conversion of class files into .dex file through Dex compiler that runs on Dalvik VM.<\/li>\n<li>Converting multiple class files into dex files.<\/li>\n<\/ul>\n<p>The Dex compiler helps convert the class file into .dex file, the following image shows how it flows:<\/p>\n<ul>\n<li>First of all the .java file converts into .class file with the help of Java compiler.<\/li>\n<li>Next .class file converts into .dex file using Dec compiler.<\/li>\n<li>Then finally the packaging process is handled by the Android Assets packaging (aapt) tools.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/Working-of-Dex-Compiler.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-77743\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/Working-of-Dex-Compiler.jpg\" alt=\"Working of Android Dex Compiler\" width=\"720\" height=\"496\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/Working-of-Dex-Compiler.jpg 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/Working-of-Dex-Compiler-150x103.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/Working-of-Dex-Compiler-300x207.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/Working-of-Dex-Compiler-520x358.jpg 520w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p><b>Dalvik Virtual Machine vs Android Runtime:<\/b><\/p>\n<p>Let us see comparison between Android DVM and <a href=\"https:\/\/data-flair.training\/blogs\/android-architecture\/\">Android Runtime<\/a>:<\/p>\n<table>\n<tbody>\n<tr>\n<td><b>Dalvik Virtual Machine<\/b><\/td>\n<td><b>Android Runtime<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Dalvik\u00a0 is slower in comparison to Android Runtime<\/span><\/td>\n<td><span style=\"font-weight: 400\">Android Runtime is faster than Dalvik Virtual Machine<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Dalvik Virtual Mchine takes less time to boot, Booting is fast<\/span><\/td>\n<td><span style=\"font-weight: 400\">Android Runtime takes more time to boot, Booting is slow<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">The Cache builds up fast over time, reducing the reboot time<\/span><\/td>\n<td><span style=\"font-weight: 400\">The cache is built at first boot, increasing the reboot time<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Dalvik Virtual Mchine needs less space as it uses Just In Time\u00a0 compiler<\/span><\/td>\n<td><span style=\"font-weight: 400\">Android Runtime needs more space as it uses AOT.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Dalvik Virtual Mchine utilizes more battery, thus it has low battery performance<\/span><\/td>\n<td><span style=\"font-weight: 400\">Android Runtime utilizes less battery, thus it has high battery performance<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Dalvik Virtual Mchine has a poor Garbage collection when compared to Android Runtime<\/span><\/td>\n<td><span style=\"font-weight: 400\">Android Runtime has a better Garbage collection when compared to DVM<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">In Android DVM, apps are less responsive in accordance with Android Runtime<\/span><\/td>\n<td><span style=\"font-weight: 400\">Apps here are very responsive and work smoothly.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Dalvik Runtime Virtual Machine converts bytecode every time the application launches<\/span><\/td>\n<td><span style=\"font-weight: 400\">On the other hand, Android Runtime converts the bytecode only once at the time of installation of application<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">It is a stable and time-tested virtual machine<\/span><\/td>\n<td><span style=\"font-weight: 400\">It is highly experimented and new<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">DVM is the choice of Android developers<\/span><\/td>\n<td><span style=\"font-weight: 400\">It doesn\u2019t have a lot of support from app developers until now<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">DVM works better for lower internal storage devices as space occupied is less<\/span><\/td>\n<td><span style=\"font-weight: 400\">It consumes more internal storage space, as it stores compiled apps in addition to the APKs<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">It came prior to Android Runtime and it is replaced with Android Runtime<\/span><\/td>\n<td><span style=\"font-weight: 400\">Android Runtime is the upgraded version of Dalvik Virtual Machine and comes up with a lot of improvements<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Summary<\/h3>\n<p>Finally in this article, we have read about the Dalvik Virtual Machine. We started with what is Virtual machine, then saw what is the Dalvik VM in Android and what it does. Then we saw what the flow of conversion is. At the end, we compared Android DVM with Android Runtime.<\/p>\n<p>Hope you enjoyed the article. Do rate us on <a href=\"https:\/\/g.page\/DataFlair\/review?kd\">Google<\/a> to get more articles on latest technologies.<span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:1144,&quot;href&quot;:&quot;https:\\\/\\\/g.page\\\/DataFlair\\\/review?kd&quot;,&quot;archived_href&quot;:&quot;&quot;,&quot;redirect_href&quot;:&quot;https:\\\/\\\/g.page\\\/DataFlair\\\/review\\\/?kd&quot;,&quot;checks&quot;:[],&quot;broken&quot;:false,&quot;last_checked&quot;:null,&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this DataFlair Android article, we\u2019ll read about Dalvik Virtual Machine(DVM). Android DDM was written by Dan Bornstein, and Dalvik is the name of a town in Iceland. A Dalvik virtual machine enables Android&#46;&#46;&#46;<\/p>\n","protected":false},"author":10,"featured_media":77742,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18722],"tags":[22234,22236,22235],"class_list":["post-77698","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android","tag-dalvik-virtual-machine","tag-dalvik-virtual-machine-in-android","tag-dvm-in-android"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Working of Dalvik Virtual Machine in Android - DataFlair<\/title>\n<meta name=\"description\" content=\"Dalvik virtual machine - Learn what is a Virtual machine, what is DVM in Android, use of android DVM, comparison between DVM and Android Runtime.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/android-dalvik-virtual-machine\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Working of Dalvik Virtual Machine in Android - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Dalvik virtual machine - Learn what is a Virtual machine, what is DVM in Android, use of android DVM, comparison between DVM and Android Runtime.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/android-dalvik-virtual-machine\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-05-03T04:30:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-09-09T16:35:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/android-dalvik-virtual-machine.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"802\" \/>\n\t<meta property=\"og:image:height\" content=\"420\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Working of Dalvik Virtual Machine in Android - DataFlair","description":"Dalvik virtual machine - Learn what is a Virtual machine, what is DVM in Android, use of android DVM, comparison between DVM and Android Runtime.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/android-dalvik-virtual-machine\/","og_locale":"en_US","og_type":"article","og_title":"Working of Dalvik Virtual Machine in Android - DataFlair","og_description":"Dalvik virtual machine - Learn what is a Virtual machine, what is DVM in Android, use of android DVM, comparison between DVM and Android Runtime.","og_url":"https:\/\/data-flair.training\/blogs\/android-dalvik-virtual-machine\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2020-05-03T04:30:50+00:00","article_modified_time":"2024-09-09T16:35:05+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/android-dalvik-virtual-machine.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/android-dalvik-virtual-machine\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/android-dalvik-virtual-machine\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/a90b082e16aa38d207212d22b0581f33"},"headline":"Working of Dalvik Virtual Machine in Android","datePublished":"2020-05-03T04:30:50+00:00","dateModified":"2024-09-09T16:35:05+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/android-dalvik-virtual-machine\/"},"wordCount":767,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/android-dalvik-virtual-machine\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/android-dalvik-virtual-machine.jpg","keywords":["dalvik virtual machine","dalvik virtual machine in android","dvm in android"],"articleSection":["Android Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/android-dalvik-virtual-machine\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/android-dalvik-virtual-machine\/","url":"https:\/\/data-flair.training\/blogs\/android-dalvik-virtual-machine\/","name":"Working of Dalvik Virtual Machine in Android - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/android-dalvik-virtual-machine\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/android-dalvik-virtual-machine\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/android-dalvik-virtual-machine.jpg","datePublished":"2020-05-03T04:30:50+00:00","dateModified":"2024-09-09T16:35:05+00:00","description":"Dalvik virtual machine - Learn what is a Virtual machine, what is DVM in Android, use of android DVM, comparison between DVM and Android Runtime.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/android-dalvik-virtual-machine\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/android-dalvik-virtual-machine\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/android-dalvik-virtual-machine\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/android-dalvik-virtual-machine.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/android-dalvik-virtual-machine.jpg","width":802,"height":420,"caption":"android dalvik virtual machine"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/android-dalvik-virtual-machine\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Android Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/android\/"},{"@type":"ListItem","position":3,"name":"Working of Dalvik Virtual Machine in Android"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/a90b082e16aa38d207212d22b0581f33","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/dd6de0d647a0185cd6faf264e4ba860b0d85d08d7070766f9cd41bea5bb0b227?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/dd6de0d647a0185cd6faf264e4ba860b0d85d08d7070766f9cd41bea5bb0b227?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/dd6de0d647a0185cd6faf264e4ba860b0d85d08d7070766f9cd41bea5bb0b227?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"The DataFlair Team is passionate about delivering top-notch tutorials and resources on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. With expertise in the tech industry, we simplify complex topics to help learners excel. Stay updated with our latest insights.","url":"https:\/\/data-flair.training\/blogs\/author\/dfadteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/77698","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=77698"}],"version-history":[{"count":4,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/77698\/revisions"}],"predecessor-version":[{"id":143353,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/77698\/revisions\/143353"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/77742"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=77698"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=77698"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=77698"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}