-
Notifications
You must be signed in to change notification settings - Fork 0
/
2002.11.26.html
304 lines (237 loc) · 14.1 KB
/
2002.11.26.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
<html><head><meta http-equiv="Content-Type" content="text/html" charset=iso-8859-1"><title>Caml Weekly News</title></head><body>
<a href="2002.11.19.html">Previous week</a> <a href="index.html">Up</a> <a href="2002.12.03.html">Next week</a>
<pre>
Hello,
Here is the latest Caml Weekly News, week 19 to 26 November, 2002.
01) <a href="#1">OCaml HTTP Daemon library: ocaml-http 0.0.3</a>
02) <a href="#2">Hash consing</a>
03) <a href="#3">8 Assistant/Associate Professorships at the IT University of</a>
Copenhagen
04) <a href="#4">xmllexer</a>
05) <a href="#5">Unix.sendto Unix.recvfrom</a>
06) <a href="#6">mlgmp bugfix release</a>
07) <a href="#7">Jabbr, an XMPP library for OCaml</a>
08) <a href="#8">Why systhreads?</a>
09) <a href="#9">Web Demonstration of Type Error Slicing</a>
10) <a href="#10">caml2html v1.1</a>
<a name="1"/>======================================================================
01) OCaml HTTP Daemon library: ocaml-http 0.0.3
----------------------------------------------------------------------
Stefano Zacchiroli announced:
ocaml-http is a library inspired from perl's HTTP::Daemon that permits
to write simple HTTP daemons in OCaml, main module is named Http_daemon.
Currently GET only HTTP daemons are supported.
You can define the behaviour of your daemon defining a callback that is
invoked each time an HTTP request is received.
A simple OO interface that abstracts over HTTP requests and responses is
provided.
A set of facility functions for writing callbacks is also provided (e.g.
functions to send headers, files, and so on).
Regarding daemons' "social life" is possible to specify address and port
on which the daemon will listen to, whether or not a child is forked for
each request and a timeout after which client connections will be
closed.
A preliminary release (0.0.3) of ocaml-http is available for download
at:
Home page: <a href="http://www.students.cs.unibo.it/~zacchiro/ocaml-http.en.html">http://www.students.cs.unibo.it/~zacchiro/ocaml-http.en.html</a>
Tarball: <a href="http://www.students.cs.unibo.it/~zacchiro/stuff/ocaml-http-0.0.3.tar.gz">http://www.students.cs.unibo.it/~zacchiro/stuff/ocaml-http-0.0.3.tar.gz</a>
CVS Web: <a href="http://www.cs.unibo.it/cgi-bin/cvsweb/helm/DEVEL/ocaml-http/">http://www.cs.unibo.it/cgi-bin/cvsweb/helm/DEVEL/ocaml-http/</a>
Feedback is appreciated.
<a name="2"/>======================================================================
02) Hash consing
----------------------------------------------------------------------
Lukasz Lew asked and Jean-Christophe Filliatre answered:
> Let's suppose wy have module with such interface
>
> module X =
> type t (*big data structure*)
>
> add : string -> t
> delete : t -> ()
>
> And in the other module i keep X.t list, and i want to keep with each of
> them additional data of unknown type [at time of X compilation]
You could have a polymorphic type "'a X.t" where 'a stands for the
type of the associated data, and provide functions "add_info : 'a ->
'a t -> unit" and "get_info : 'a t -> 'a" in module X.
> Other is to keep with every t int identifier as small as possible, to keep
> additional data in array, but this solution isn't very good.
Following this kind of idea, you could do hash-consing of your X.t
values, so that they are allocated only once; doing this, it is easy
to associate a unique integer to each value in X.t, which will allow
you to build an efficient map over X.t.
I already wrote an hash-consing module, available here:
<a href="http://www.lri.fr/~filliatr/software.en.html">http://www.lri.fr/~filliatr/software.en.html</a>
(By the way, doing hash-consing has many other advantages such as
saving space, providing O(1) equality, ...)
<a name="3"/>======================================================================
03) 8 Assistant/Associate Professorships at the IT University of
Copenhagen
----------------------------------------------------------------------
Camilla Jensen announced:
The IT University of Copenhagen has 8 new Assistant/Associate Professorships
within the areas of programming language technology, software design and
implementation, networks and protocols, foundations of image analysis,
algorithms
and complexity theory, and verification.
Application deadline is January 6th, 2003.
Full announcement at <a href="http://www.it-c.dk/English/vacancies/TUBVmk/">http://www.it-c.dk/English/vacancies/TUBVmk/</a>
<a name="4"/>======================================================================
04) xmllexer
----------------------------------------------------------------------
Manuel Maarek announced:
I am pleased to announce the first release of xmllexer available here:
<a href="http://www.macs.hw.ac.uk/~mm20/xmllexer/">http://www.macs.hw.ac.uk/~mm20/xmllexer/</a>
xmllexer is an XML lexer for Camlp4. It is composed of one OCaml file
(in revised syntax). xmllexer.ml is derived from the default lexer of
Camlp4: plexer.ml (written by Daniel de Rauglaudre).
<a name="5"/>======================================================================
05) Unix.sendto Unix.recvfrom
----------------------------------------------------------------------
Salvatore Altavilla asked and Dimitri Timofeev answered:
> I would want to have an example of like sending and receiving a
> package (type string) in ocaml via UDP protocol
Maybe an attached file (an exercise) could help you. By the way,
i'd like to hear all the criticism and suggestions one may have
concerning this code.
(see the file at: <a href="http://caml.inria.fr/archives/200211/msg00255.html">http://caml.inria.fr/archives/200211/msg00255.html</a>)
<a name="6"/>======================================================================
06) mlgmp bugfix release
----------------------------------------------------------------------
David Monniaux announced:
Here is a bugfix release for mlgmp, the OCaml / GNU MP interface.
Among other things, an annoying bug triggered by garbage collection during
integer divisions was fixed.
<a href="http://www.di.ens.fr/~monniaux/download/mlgmp-20021123.tar.gz">http://www.di.ens.fr/~monniaux/download/mlgmp-20021123.tar.gz</a>
<a name="7"/>======================================================================
07) Jabbr, an XMPP library for OCaml
----------------------------------------------------------------------
Mike Lin announced:
Hi. I finally got around to documenting a first version of Jabbr, an
OCaml library for the XMPP (better known as Jabber) instant messaging
system that I wrote last summer.
<a href="http://mikelin.mit.edu/xmpp/jabbr/">http://mikelin.mit.edu/xmpp/jabbr/</a>
<a name="8"/>======================================================================
08) Why systhreads?
----------------------------------------------------------------------
Xavier Leroy lectured:
It seems that the annual discussion on threads started again. Allow
me to deliver again my standard lecture on this topic.
Threads have at least three different purposes:
1- Parallelism on shared-memory multiprocessors.
2- Overlapping I/O and computation (while a thread is blocked on a network
read, other threads may proceed).
3- Supporting the "coroutine" programming style
(e.g. if a program has a GUI but performs long computations,
using threads is a nicer way to structure the program than
trying to wrap the long computation around the GUI event loop).
The goals of OCaml threads are (2) and (3) but not (1) (for reasons
that I'll get into later), with historical emphasis on (2) due to the
MMM (Web browser) and V6 (HTTP proxy) applications.
Pure user-level scheduling, or equivalently control operators (call/cc),
provide (3) but not (2).
To achieve (2) with a user-level scheduler such as OCaml's bytecode
thread library requires all sorts of hacks, such as non-blocking I/O
and select() under Unix, plus wrapping of all I/O operations so that
they call the user-level scheduler in cases where they are about to
block. (Otherwise, the whole process would block, and not just the
calling thread.)
Not only this is ugly (read the sources of the bytecode thread library
to get an idea) and inefficient, but it interacts very poorly with
external libraries written in C. For instance, deep inside the C
implementation of gethostbyname(), there are network reads that can
block; there is no way to wrap these with scheduler calls, short of
rewriting gethostbyname() entirely.
To make things worse, non-blocking I/O is done completely differently
under Unix and under Win32. I'm not even sure Win32 provides enough
support for async I/O to write a real user-level scheduler.
Another issue with user-level threads, at least in native code, is the
handling of the thread stacks, especially if we wish to have thread
stacks that start small and grow on demand. It can be done, but is
highly processor- and OS-dependent. (For instance, stack handling on
the IA64 is, ah, peculiar: there are actually two stacks that grow in
opposite directions within the same memory area...)
One aspect of wisdom is to know when not to do something oneself, but
leave it to others. Scheduling I/O and computation concurrently, and
managing process stacks, is the job of the operating system. Trying
to do it entirely in a user-mode program is just not reasonable.
(For another reference point, see Java's move away from "green
threads" and towards system threads.)
What about parallelism on SMP machines? The main issue here is that
the runtime system, and in particular the garbage collector and memory
manager, must be MP-safe. This means minimizing global state, and
introducing locking around accesses to shared resources. If done
naively (e.g. locking at each heap allocation), this can be extremely
costly; it also complicates the runtime system a lot. Finally,
garbage collection can become a limiting factor if it is done in the
"stop the world" fashion (all threads stop during GC); a concurrent GC
avoids this problem, but adds tremendous complexity.
(Of course, all this SMP support stuff slows down the runtime system
even if there is only one processor, which is the case for almost all
our users...)
All this has been done before in the context of Caml: that was
Damien Doligez's Concurrent Caml Light system, in the early 90s.
Indeed, the incremental major GC that we have in OCaml is a
simplification of Damien's concurrent GC. If you're interested, have
a look at Damien's publications.
Why was Concurrent Caml Light abandoned? Too complex; too hard to debug
(despite the existence of a machine-checked proof of correctness);
and dubious practical interest. Shared-memory multiprocessors have
never really "taken off", at least in the general public. For large
parallel computations, clusters (distributed-memory systems) are the
norm. For desktop use, monoprocessors are plenty fast. Even if you
have a 4-processor SMP machine, it isn't clear whether you should
write your program using shared memory or using message passing -- the
latter is slightly more expensive, but scales to clusters...
What about hyperthreading? Well, I believe it's the last convulsive
movement of SMP's corpse :-) We'll see how it goes market-wise. At
any rate, the speedups announced for hyperthreading in the Pentium 4
are below a factor of 1.5; probably not enough to offset the overhead
of making the OCaml runtime system thread-safe.
In summary: there is no SMP support in OCaml, and it is very very
unlikely that there will ever be. If you're into parallelism, better
investigate message-passing interfaces.
(this of course has spawned an active thread, starting here:
<a href="http://caml.inria.fr/archives/200211/msg00274.html">http://caml.inria.fr/archives/200211/msg00274.html</a>)
<a name="9"/>======================================================================
09) Web Demonstration of Type Error Slicing
----------------------------------------------------------------------
Christian Haack announced:
Previous methods have generally identified the location of a type
error as a particular program point or the program subtree rooted at
that point. In the paper "Type Error Slicing in Implicitly Typed
Higher-Order Languages" by two of us (Haack and Wells), we present a
new approach that treats the location of a type error as a minimal set
of program points which are necessary for the type error and presents
this "location" as a slice of the program. Connected to this paper,
we have implemented type error slicing for a subset of core Standard
ML.
We have prepared a web interface that allows you to experiment with
our implementation using just your web browser. This interface is now
available at:
<a href="http://www.cee.hw.ac.uk/ultra/compositional-analysis/type-error-slicing/">http://www.cee.hw.ac.uk/ultra/compositional-analysis/type-error-slicing/</a>
<a name="10"/>======================================================================
10) caml2html v1.1
----------------------------------------------------------------------
Sebastien Ailleret announced:
I'm pleased to announce v1.1 of caml2html. Caml2html is a tool which
creates hilighted html pages from OCaml files (.ml, .mli, .mll and
.mly). You can see an example of its output here :
<a href="http://perso.wanadoo.fr/sebastien.ailleret/caml/html/overflow.mli.html">http://perso.wanadoo.fr/sebastien.ailleret/caml/html/overflow.mli.html</a>
You can get caml2html from my OCaml page :
<a href="http://perso.wanadoo.fr/sebastien.ailleret/caml/">http://perso.wanadoo.fr/sebastien.ailleret/caml/</a>
This new version introduces the following improvements :
- possible use of css to choose the colors you want
- can concat several ml files in a single html document
- better interaction between ml and html ('<', '>', ';')
- many performances improvements
======================================================================
Old cwn
----------------------------------------------------------------------
If you happen to miss a cwn, you can send me a message
([email protected]) and I'll mail it to you, or go take a look at
the archive (<a href="http://pauillac.inria.fr/~aschmitt/cwn/">http://pauillac.inria.fr/~aschmitt/cwn/</a>). If you also wish
to receive it every week by mail, just tell me so.
======================================================================
Alan Schmitt
</pre></body></html>