SlideShare ist ein Scribd-Unternehmen logo
1 von 15
Downloaden Sie, um offline zu lesen
elixir for a concurrent world
concurrency
when two or more tasks can start, run, and complete in
overlapping time periods.
os processes
Pros
They have separate sections of memory.
No side effects: If VIM crashes, Chrome is unaffected.
Cons
Unfortunately, expensive...
os threads
Pros
Lighter than OS processes
They do not block each other
They run on separate CPUs, so they are truly parallel
Cons
Still pretty heavy weight
Shared memory
green threads
Threads that are scheduled by a virtual machine, rather than the
OS.
Pros
They don't take up a lot of memory.
Cons
Green thread implementations normally cannot assign work to
multiple processors.
A blocking I/O operation can block all green threads.
so how heavy is "heavy"?
A POSIX thread has a configurable stack size. On my
machine, the default is 8Mb.
JVM, .NET, RubyVM, and CPython all use 1Mb by default.
Therefore, memory usage will add up quickly.
[Erlang] is a concurrent language – by that I mean that
threads are part of the programming language, they do not
belong to the operating system. That's really what's wrong with
programming languages like Java and C++. It's threads aren't in
the programming language, threads are something in the
operating system – and they inherit all the problems that they
have in the operating system. One of the problems is granularity
of the memory management system. The memory management
in the operating system protects whole pages of memory, so the
smallest size that a thread can be is the smallest size of a page.
That's actually too big.
-- Joe Armstrong
goroutines
Initial stack size is 2kb (as of 1.4), but then is dynamically
allocated
goroutines are green threads that are multiplexed as needed
onto native threads, so there isn't a 1:1 mapping.
erlang processes
so...
Not an OS process, but still isolated.
No side effects. If a process crashes, other processes are not
affected.
Managed by the VM, rather than the OS.
Immutable data structures sidestep shared mutable state.
Processes communicate through message passing.
Fault-tolerant
go on...
Lightweight memory footprint.
Dynamically allocated stack.
All of this applies to Elixir as well.
{_, bits} = :erlang.process_info(
spawn(fn -> nil end),
:memory
)
bits / 8 # 340.0
who cares?
we are now able to easily push our systems to over 2 million tcp
connections!
-- WhatsApp (https://blog.whatsapp.com/196/1-million-is-so-
2011)
so how do processes talk?
Sources:
https://www.youtube.com/watch?v=hlmMi0pWzJE
http://blog.nindalf.com/how-goroutines-work/
http://www1.erlang.org/doc/efficiency_guide/processes.html
https://speakerdeck.com/7grok/processes-threads-and-the-
death-of-moores-law
http://learnyousomeerlang.com/
https://www.infoq.com/presentations/erlang-software-for-a-
concurrent-world

Weitere ähnliche Inhalte

Andere mochten auch

Rocket City Perk6e
Rocket City Perk6eRocket City Perk6e
Rocket City Perk6eM.T. Bryan
 
logo5
logo5logo5
logo5AZOTT
 
Atividade 2 ficha de apoio - história e física e química
Atividade 2  ficha de apoio - história e física e químicaAtividade 2  ficha de apoio - história e física e química
Atividade 2 ficha de apoio - história e física e químicaantoniopedropinheiro
 
Pink Floyd Digipak
Pink Floyd DigipakPink Floyd Digipak
Pink Floyd DigipakRuben Clark
 
Add Some Ninja To Your Website
Add Some Ninja To Your WebsiteAdd Some Ninja To Your Website
Add Some Ninja To Your WebsiteCameron Jones
 
Toimeentulotuen kuumat perunat sidosryhmätilaisuus 09022017
Toimeentulotuen kuumat perunat  sidosryhmätilaisuus  09022017Toimeentulotuen kuumat perunat  sidosryhmätilaisuus  09022017
Toimeentulotuen kuumat perunat sidosryhmätilaisuus 09022017Kela
 
Active Sourcing: WOW, ich habe einen Kandidaten! Und jetzt?
Active Sourcing: WOW, ich habe einen Kandidaten! Und jetzt?Active Sourcing: WOW, ich habe einen Kandidaten! Und jetzt?
Active Sourcing: WOW, ich habe einen Kandidaten! Und jetzt?Barbara Braehmer
 

Andere mochten auch (11)

photo book
photo bookphoto book
photo book
 
Rocket City Perk6e
Rocket City Perk6eRocket City Perk6e
Rocket City Perk6e
 
logo5
logo5logo5
logo5
 
Atividade 2 ficha de apoio - história e física e química
Atividade 2  ficha de apoio - história e física e químicaAtividade 2  ficha de apoio - história e física e química
Atividade 2 ficha de apoio - história e física e química
 
Comercio internacional
Comercio internacionalComercio internacional
Comercio internacional
 
Pink Floyd Digipak
Pink Floyd DigipakPink Floyd Digipak
Pink Floyd Digipak
 
Tract bibliodebout2
Tract bibliodebout2Tract bibliodebout2
Tract bibliodebout2
 
Add Some Ninja To Your Website
Add Some Ninja To Your WebsiteAdd Some Ninja To Your Website
Add Some Ninja To Your Website
 
Toimeentulotuen kuumat perunat sidosryhmätilaisuus 09022017
Toimeentulotuen kuumat perunat  sidosryhmätilaisuus  09022017Toimeentulotuen kuumat perunat  sidosryhmätilaisuus  09022017
Toimeentulotuen kuumat perunat sidosryhmätilaisuus 09022017
 
meganvietorUnisys2016
meganvietorUnisys2016meganvietorUnisys2016
meganvietorUnisys2016
 
Active Sourcing: WOW, ich habe einen Kandidaten! Und jetzt?
Active Sourcing: WOW, ich habe einen Kandidaten! Und jetzt?Active Sourcing: WOW, ich habe einen Kandidaten! Und jetzt?
Active Sourcing: WOW, ich habe einen Kandidaten! Und jetzt?
 

Ähnlich wie Elixir for a Concurrent World: Lightweight Processes and Message Passing

Ähnlich wie Elixir for a Concurrent World: Lightweight Processes and Message Passing (20)

ppt
pptppt
ppt
 
Project Earl Grey
Project Earl GreyProject Earl Grey
Project Earl Grey
 
Actors, Fault tolerance and OTP
Actors, Fault tolerance and OTPActors, Fault tolerance and OTP
Actors, Fault tolerance and OTP
 
Shared memory Parallelism (NOTES)
Shared memory Parallelism (NOTES)Shared memory Parallelism (NOTES)
Shared memory Parallelism (NOTES)
 
4.Process.ppt
4.Process.ppt4.Process.ppt
4.Process.ppt
 
Memory management
Memory managementMemory management
Memory management
 
Architecture of web servers
Architecture of web serversArchitecture of web servers
Architecture of web servers
 
Threads
ThreadsThreads
Threads
 
Java Threading
Java ThreadingJava Threading
Java Threading
 
Osdc 2011 michael_neale
Osdc 2011 michael_nealeOsdc 2011 michael_neale
Osdc 2011 michael_neale
 
A quick view about Java Virtual Machine
A quick view about Java Virtual MachineA quick view about Java Virtual Machine
A quick view about Java Virtual Machine
 
Ruby Concurrency
Ruby ConcurrencyRuby Concurrency
Ruby Concurrency
 
Unit 1 q&a
Unit  1 q&aUnit  1 q&a
Unit 1 q&a
 
Linux Memory
Linux MemoryLinux Memory
Linux Memory
 
Linux Internals - Interview essentials - 1.0
Linux Internals - Interview essentials - 1.0Linux Internals - Interview essentials - 1.0
Linux Internals - Interview essentials - 1.0
 
Mysql talk
Mysql talkMysql talk
Mysql talk
 
Concurrent Programming with Ruby and Tuple Spaces
Concurrent Programming with Ruby and Tuple SpacesConcurrent Programming with Ruby and Tuple Spaces
Concurrent Programming with Ruby and Tuple Spaces
 
Multiprocessor system
Multiprocessor systemMultiprocessor system
Multiprocessor system
 
Wiki 2
Wiki 2Wiki 2
Wiki 2
 
unit5_os (1).pptx
unit5_os (1).pptxunit5_os (1).pptx
unit5_os (1).pptx
 

Kürzlich hochgeladen

(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 

Kürzlich hochgeladen (20)

(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 

Elixir for a Concurrent World: Lightweight Processes and Message Passing