<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi there,<br>
<br>
To learn Erlang, I have recently switched from "learn you some
Erlang" (<a class="moz-txt-link-freetext" href="http://learnyousomeerlang.com">http://learnyousomeerlang.com</a>) to building actual programs.<br>
<br>
My first real Erlang program was a multi-process, multi-host,
wxWidgets-based file-transfer application with 768 lines of Erlang
code.<br>
I was surprised how simple it is to get this distributed
functionality built, cleanly, in Erlang.<br>
Much appreciation goes to [erlang-questions]-subscribers, who guided
me to various solutions when I needed an Erlang implementation of
the Singleton design pattern.<br>
The 'ets' dictionary solution worked for me, after I figured it out.<br>
<br>
Currently, I am finishing a Maze-generation program (114 lines of
packed Erlang code), and have put the final version up on the
Rosetta Code web-site.<br>
(see the <a class="moz-txt-link-freetext" href="http://rosettacode.org/wiki/Maze_generation#Erlang">http://rosettacode.org/wiki/Maze_generation#Erlang</a>
...Alternative example (implemented with 2 diagraphs)).<br>
<br>
From doing this experiment, I have a few questions:<br>
<br>
1. The original Erlang maze-generation code (same Rosetta web-site
page) used a light-weight process for each vertex in the maze.<br>
This is a very good example of how the Erlang process
architecture can support many light-weight processes.<br>
I was surprised that it actually worked, until I tried
generating a bigger maze.<br>
When I used the original Erlang maze example to generate a maze
of 25 columns x 4000 rows, it brought my PC down to a crawl.<br>
I couldn't do anything (I am running Windows 7 64-bit on 9 GB of
RAM) until I killed EPMD from Task Manager.<br>
Even after killing EPMD, it took quite a while for the computer
to get back to normal again, which indicates that it may not have
been EPMD causing the problem.<br>
<br>
Here is the question (part a): should I expect EPMD (or the WERL
process) to slow to a crawl with 100,000 Erlang processes running on
a single machine?<br>
(part b): If yes, what would
be the Erlang programmer's defence tactic against this scenario?<br>
<br>
2. 114 packed lines of Erlang code just seems to over-coded for such
a powerful language.<br>
Not being an expert, yet, in all the nuances of Erlang, can
someone suggest ways I can decrease maze.erl code down to 99 lines
or less, without cheating (removing too many newlines)?<br>
<br>
Thanks,<br>
Bill<br>
<br>
<span style="color: rgb(51, 51, 51); font-family: 'Helvetica Neue',
Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal;
font-variant: normal; font-weight: bold; letter-spacing: normal;
line-height: 20px; orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal; widows: 1;
word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline
!important; float: none; background-color: rgb(255, 255, 255);"></span>
</body>
</html>