OpenLLM-France/wikimedia huggingface dataset:
# Linux Applications Debugging Techniques/Signals
## Links of interest

* SIGSEGV to exception
# Linux Applications Debugging Techniques/Stack corruption

Stack corruption is rather hard to diagnose. Luckily, gcc 4.x can instrument the code to check for stack corruption:
* -fstack-protector Add stack protection to functions that have “alloca” or have a (signed or unsigned) char array with size > 8 (SSP_BUFFER_SIZE)
* -fstack-protector-strong To more functions, see below
* -fstack-protector-all To ALL functions
gcc will add guard variables and code to check for buffer overflows upon exiting a function. A quick example:
When run, the program will dump core:

### -fstack-protector-strong

Added by google to gcc.
Benefit - gain big performance while sacrificing little security (for scenarios using -fstack-protector-all)
Background - some times stack-protector is too-simple while stack-protector-all over-kills, for example, to build one of our core systems, we forcibly add "-fstack-protector-all" to all compile commands, which brings big performance penalty (due to extra stack guard/check insns on function prologue and epilogue) on both atom and arm. To use "-fstack-protector" is just regarded as not secure enough (only "protects" <2% functions) by the system secure team. "-fstack-protector-strong" hits the balance between "-fstack-protector" and "-fstack-protector-all".
Adds the check to a function:
* if any of its local variable’s address is taken, as part of the RHS of an assignment
* or if any of its local variable’s address is taken as part of a function argument.
* or if it has an array, regardless of array type or length
* or if it has a struct/union which contains an array, regardless of array type or length.
* or if function has register local variables
See http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00974.html

##### Further reading

* http://www.drdobbs.com/cpp/240001832
* New -strong stack protector option for gcc
Starting with gcc 4.9 and later, you can use the ubsan sanitizer for bounds checking.
# Linux Applications Debugging Techniques/Resource leaks
### Zombie threads

Any thread that has terminated but has not been joined or detached will leak OS resources until the process terminates. Unfortunately, neither /proc nor gdb will show you these zombie threads, at least not on some kernels.
One way to get them is with a gdb canned command:
Another way is to use (again) an interposition library:
The output is a bit rough but it can be refined down to file and line by replacing backtrace_symbols_fd with appropriate code:

### File descriptors

As just about anything is a file (folders, sockets, pipes, etc.), just about anything can result in a file descriptor that needs to be closed. /proc can help:
The trace_call command for gdb can help with the call stack.
If gdb is not available on the machine, an interposition library hooking open, pipe, socket, etc. can be built.
Other tools that can be used:
* lsof
* fuser

### Ports

Which process is using a port? As root:
Other tools:
* fuser

### IPC

For semaphores, shared memory and message queues.
* ipcs
* ipcrm

### DYI: an interposition resource counter

libmemleak can be easily modified to keep track of whatever resources are leaking. Hook the right API (e.g. open/close).
# Linux Applications Debugging Techniques/The call stack
### The API

Sometimes we need the call stack at a certain point in the program. These are the API functions to get basic stack information:
Notes:
* C++ symbols are still mangled. Use abi::__cxa_demangle or something similar.
* Some of the these functions do allocate memory - either temporarily either explicitly - and this might be a problem if the program is unstable already.
* Some of the these functions do acquire locks (e.g. dladdr).
* backtrace* are expensive calls on some platforms (x86_64 for instance), the deeper the call stack is the more expensive the call is.
* dladdr will fail to rsolve any symbol that is not exported. Hence, to get the most out of it:
** Link with -rdynamic and -ldl
To extract more information (file, line number), use libbfd. Possible alternatives: libbacktrace; http://libcsdbg.sourceforge.net/

### A C++ wrapper

With this simple class, getting the stack is one line away:
This class can be used with assertions, logging or exceptions.
The full code can be found at the LPT site and it offers three symbol resolver varieties. This code will require a C++11 compiler.
* A "basic" address-only resolver, without memory side-effects
* A libc resolver
* A libbfd resolver
A boost-based version of the call stack utilities collection can be found at https://github.com/melintea/Boost-Call_stack.
A stack resolved with the libc resolver, embedded in an exception, with debug-compiled code would look like:
Note how dladdr fails to resolve some of the frames. Whereas a stack resolved with the bfd resolver would show file and line numbers and would resolve all frames:

##### Caveats

* Do NOT use in asynchronous interrupts such as signal handlers.
* It might or it might not work when the program is unstable - prefer a core dump if possible. Same for memory issues handlers .
* Performance hit varies greatly with platform and compiler version.

### From within gdb

A canned command to resolve a stack address from within gdb:

### Links

* Calling conventions
# Linux Applications Debugging Techniques/Transactional memory
### Notes

* If writing alters a cache line used in a transaction that transaction will be aborted.

##### References

* Lock elision in the GNU C library
* Intel extensions
# Linux Audio: A Guide For Beginner and Beyond
## Foreword
### Preface

    About This Book

### Authors

    A Word From the Contributors

## For the Beginner
### Introduction

    Get a basic sound-enabled system up and running

### First Things First

    Choosing A Distribution

## Linux Sound Systems and Terminology
### Sound Support History

    OSS

### ALSA

    Basic block for sound support, "Safe ALSA" standard

### For the Pro-Audio-Minded User

    The JACK Audio Connection Kit

## Usage Scenarios
### Linux DAW - Digital Audio Workstation

    Using linux as an audio workstation for sound and music: system setup, software, hardware, MIDI and optimizing for low-latency.

### Video Synchronization

    Audio aspect related to video creation and editting: hardware differences, synchronization, format conversion, and media authoring.

### WEB Audio

    Making rich media content for web: web-based formats, tools, optimizations and streaming.

### Game Audio

    Playing games: system settings, peripheral devices, surround sound output and wine compatibility.

## Audio Programming in Linux
### Linux Audio API

    How to develop sound-enabled software: introduction to libraries and techniques with examples.

### List of Dependencies and Compiling Tips

    Development prerequisites and requirements
# Linux Applications Debugging Techniques/The compiler

When requested to optimize (-O2 and above), the compiler is granted a "total license" to modify it: treats undefined behavior (by the standard) as it cannot happen. Thus, the resulting code behaves differently in release-optimized mode than debug mode. Such differences in behavior cannot be found by static analyzers or code reviews.

### Signed Integer Overflow

1. This is C99 undefined behavior and the compiler assumes overflow cannot occur. Thus, any checks for overflow are discarded and the following is an infinite loop in optimized code:
2. The following:
is optimized into:
* Use -Wstrict-overflow=N with N>=3 to signal cases where code is optimized away.
* Use -fwrapv
If lucky enough to use gcc 4.9 and later, you can use the ubsan sanitizer:
* compile and link the program with -fsanitize=undefined option
* use other available flags as needed.

### Unsigned Wrap Around

The compiler assumes unsigned integers do not wrap. Keep the unsigned variables in the range [INT_MIN/2, INT_MAX/2] to avoid surprises.

### "Dead Code" Removed

The memset call could be removed because the compiler deems buf unused at that point in the code and after:
* Use #pragma optimize directives to force the code in.
* Use volatile.

### volatile Pitfalls

Code can be moved around:
could be optimized into:
* Use compiler intrinsic barriers to prevent the flag moving.
Loops could be optimized into one read call only:

### Pointers

* Use restrict
* Use -fno-delete-null-pointer-checks. Null pointer checks are deleted if placed after the first use of the pointer.

### References

* Dangerous Optimizations
* http://blog.regehr.org/archives/918
* LWN about optimizations
* LWN about optimizations (bis)
* cdecl
* Sources of the first C compiler
* gcc internals
# Linux Applications Debugging Techniques/The dynamic linker
### Dependencies

* ldd -d -r /path/to/binary
* A script to visualize libraries and their dependencies.
* Binaries Analysis Tools
* tldd

### Resolved symbols

To find out which dynamic library is a symbol coming from:

##### References

* man 8 ld.so
* libc symbols visibility & linking

### Notes

* It is run under whatever credentials would be accorded to the application program; thus, for example, if a set-user-ID-root program is being executed, the dynamic linker will run with an effective user ID of root.

### Varia

* A look at dynamic linking
# RF MEMS

* RF_MEMS

# Reliability design rules

Sandia has published a set of "reliability design rules" for MEMS devices intended to avoid failure modes experienced in early MEMS device tests. The most common failure mechanism was wear of the rubbing surfaces.

# References

See also notes on editing this book about how to add references Microtechnology/About#How to Contribute.
* ↑ Danelle M. Tanner et. al. "MEMS Reliability: Infrastructure, Test Structures, Experiments, and Failure Modes". Sandia. 2000.
# Microelectronics

See the Wikibook Semiconductors on electronic devices

# CMOS

complementary metal oxide semiconductor

# References

See also notes on editing this book about how to add references Microtechnology/About#How to Contribute.
# Teaching Microtechnology

Course materials available on the net:

# References

See also notes on editing this book about how to add references Microtechnology/About#How to Contribute.
# Lithography

* SPIE Handbook
* Intro to lithography

# Ultra Violet Lithography (UVL)

* Photolithography
* Photoresist

## Masks for UVL

Various types of masks are in use for UVL:
* Chrome-on glass maks for structures down to micron-resolution
* Acetate masks for structures with minimum dimensions of tens of microns

## Resists for UVL
### Negative UVL resists

* PMMA
* SU-8

### Positive UVL resists
# Electron Beam Lithography (EBL)

Electron beam lithography offers linewidths down to the few nm range, much smaller than what can bea achieved by optical lithography. One drawback is that the pattern writing is a serial process and hence very time consuming for larger structures.
Resources on the net
* SPIE Handbook of Microlithography, Micromachining and Microfabrication has an online chapter on EBL

## What determines the EBL resolution

* Beam diameter
* Resist sensitivity
* development method
* Proximity effect
* Resist thickness

## Electron beam resists
### Negative E-beam resists

negative e-beam resists will remain in the irradiated areas after development.
* Electron beam induced deposition
* PMMA
* SU-8

### Positive E-beam resists

Positive e-beam resists will be removed in the electron irradiation areas upon development. PMMA Typical PMMA process
* 300nm PMMA think film made by spinning 950k PMMA 5% in anisole at 5000rpm for 30sec (avoid bubbles in the resist when placing it on the wafer, use about 3ml for a 4" wafer).
* drying 180C Hot plate for 2 min or oven bake for at least 2h at 180 C. Oven takes longer than hot plate as convection heat trasnfer is slower than contact transfer.
* Electrob beam lithography. Dosage depends on pattern density and acceleration voltage.
* Developing in MIBK:IPA (1:3) for 60s and rinse in IPA for 30s.
* Post bake to improve etch resistance. 30 min at 110C
* 5 mBar Oxygen plasma in faraday cage for 20 sec to remove residual resist.
* For instance metal evaporation to form metal structures, followed by liftoff 5 min in hot remover s-1165 and acetone in several fresh baths to remove liftoff fragments.
** ZEP

# Resist Coatings

* Spinning
* Electrochemical coating
* Spray coating (Spray coaters are made by eg. EVG)
* Drop casting
* Self assembled monolayers

# References

See also notes on editing this book about how to add references Microtechnology/About#How to Contribute.
# Microfluidics and Sensors

* introductory paper in physics today

# References

There is an other wikibook dedicated entirely on the topic of Microfluidics.
See also notes on editing this book about how to add references Microtechnology/About#How to Contribute.
# Electro-optical Devices

Mach-Zender optical modulator, also spelled the Mach-Zehnder interferometer.

# References

See also notes on editing this book about how to add references Microtechnology/About#How to Contribute.
* ↑ "Mach-Zender Based Optical Modulator"
# Insulators
## Polymers

* tables of properties of polymers

# Silicon Dioxide

Silicon Dioxide

# Silicon Nitride

Silicon Nitride

# PMMA

PMMA

# PDMS

PDMS

# SU8

SU8

# References

See also notes on editing this book about how to add references Microtechnology/About#How to Contribute.
# Introduction

Without microchips you would not be reading this page... Microtechnology and microfabrication is a fundamental prerequisite for modern life.
This wikibook can hopefully become an opensource handbook in microfabrication. With the possibility to spawn subchapters, it should be possible to make detailed discussions of the various fabrication techniques and the processing details.
The devil is in the detail, and most people doing processing seem to have the same few lists that have been made on etch rates etc. Here, in the wiki system, users should be able to contribute and expand the readily available knowledge.
Hope you will contribute!! Things can always be changed, so its better to add things and comments to the book than just reading it!! Don't be afraid to participate :-)
Micro technology involves changing things in the scale of one micro metre, thats 0.000001 m or (10$^{-6}$ m)

# References

See also notes on editing this book about how to add references Microtechnology/About#How to Contribute.
# Microbiology/The 3 Domains of Life

The three Domains of organisms are:
Domain Archaea, which consists of the Archaeans, or extremophiles.
Domain Bacteria, which consists of all the bacteria.
Domain Eukarya, which consists of all eukaryotic organisms, or those with the largest, most complex cells and the most advanced compartmentalization.
# Microeconomics/Definition
## Economics: The Formation of the Branched Tree

Economics is a social science that studies how individuals make choices to allocate rare resources for the satisfaction of what appears to be unlimited desires and how individuals interact with one another. It is about everyday life, about what choices everyone makes, and how those choices affect others. Often, economics is broken-down into two branches: microeconomics and macroeconomics.

### Microeconomics and Macroeconomics

Microeconomics looks at the smaller picture and focuses more on the individual interactions made in particular markets. To be more precise, microeconomics is a branch of economics that analyzes the market behavior of individual consumers and firms in an attempt to understand the decision-making process of sellers and buyers. It is concerned with the interaction between individual suppliers and demanders and the factors that influence the choices made by buyers and sellers. In particular, microeconomics focuses on patterns of supply and demand and the determination of price and output in individual markets (e.g. coffee industry). People who have any desire to start their own business or who want to learn the rationale behind the pricing of particular products and services would be more interested in this area. Macroeconomics, on the other hand, looks at the big picture (hence "macro-"). It focuses on the national economy as a whole and provides a basic knowledge of how things work in the business world. For example, people who study this branch of economics would be able to interpret the latest Gross Domestic Product figures or explain why a 6% rate of unemployment is not necessarily a bad thing. Thus, for an overall perspective of how the entire economy works, you need to have an understanding of economics at both the micro- and macro- levels. To put it simply, macroeconomics focuses on the aggregate national performance of a particular country.
There are two main concepts that we need to understand that not only form the basis of this branch but all of economics: opportunity cost and scarcity. With these two concepts, we can understand almost all human and economic behavior.
# Microbiology/Summary of differences between Bacteria, Archea and Eukaryotes
## Summary of differences between Bacteria, Archea and Eukaryotes

| | Bacteria | Archea | Eukaryotes |
| membrane bound organelles and a nucleus | No | No | Yes |
| Ribosome size | 70S | 70S | 80S (mitochondria and chloroplasts contain 70S ribosomes) |
| Type of bond between lipids in the cell membrane | ester | ether | ester |
# Microeconomics/Oligopolistic Competition

Goals:
* To explain how Duopoly and Oligopoly works
* To explain price-based competition (Bertrand)\
To achieve these goals, we build on the definitions from Perfect Competition:
* Profit
* The Short Run (SR) v. The Long Run (LR)
* Production Function
* Principle of diminishing returns
* Firm Production Decision
* Profit Maximization Rule

## Oligopolistic Competition

Introduction to oligopolies, introduce the special case of duopolies.

### Case 2: Oligopolistic Competition
## Bertrand competition

Price setting
# Microeconomics
## Preface

The goal of this book is to explain how people interact economically, understanding the relationship between people, supply and demand, markets, and efficiency. We will do this by first understanding the nature of the basics concepts of microeconomics, then proceeding to the application of the concepts in specific types of situations.
Readers are expected to have an understanding of arithmetics as well as basic differential calculus. Where needed, we use R for statistical programming. The graphics are also created using R, the needed code can be revealed by clicking on the graphic.

## Table of Contents

* Definition
* Goods and Scarcity
* Economic Systems
* Supply and Demand
* Opportunity Cost
* Perfect Competition
* Monopolistic Competition
* Oligopolistic Competition
# Microeconomics/Monopolistic Competition

Goals:
* To introduce monopolistic competition
* To show the Dead-Weight Loss (DWL)
To achieve these goals, we build on the definitions from Perfect Competition:
* Profit
* The Short Run (SR) v. The Long Run (LR)
* Production Function
* Principle of diminishing returns
* Firm Production Decision
* Profit Maximization Rule
# Lojban/Pro-bridi

A word that functions as a pro-bridi is any word that temporarily has the same meaning as another bridi (such as a pro-sumti, or in English, a hypothetical "pro-verb").

## Additional Notes and/or Examples

* [cu] is not required when preceding a pro-selbri in the broda series.
* Like [goi], [cei] does not always need to assign a pro-selbri of the broda series.
** [lo tricu cu pu melbi cei mua mi .i lo nanmu mua mi] = The/a tree was beautiful/good-looking <assign: mua ( = current bridi meaning = pu melbi = English: was good-looking)> to me. The man was <reference assign: mua = pu melbi = English: was beautiful> to me.
*** In the immediately previous example, any occurrence of [mua] thereafter would mean [pu melbi], or "was good-looking". The pro-bridi keeps the same tense as the original selbri.
* Pro-bridi not only reference the relation (selbri), and therefore the Lojbanic tense of the selbri, of a bridi; but all of the sumti as well. They do not, however, reference other participles (such as "xu", question/true-or-false...?). They also reference the meaning of the bridi, not the precise words.
** xu do prami mi
       .i go'i (= .i mi prami do)
*** Do you love me?
          repeat: last bridi meaning = (that-you = I) love (that-me = you) = Yes, I love you.
* Iff not edited, a pro-bridi repeats the exact same sumti, tense, etc. as the bridi being referenced (though not other participles, as per immediately preceding and above). However, if sumti, tenses, etc. are specifically stated, then they replace the respective sumti, tenses, etc. of the referenced bridi.
** [mi prami la dulsinei,as. --> .i la don kixoteis. (cu) pu go'i] = I love Dulcinea. --> Immediately previous bridi; with rewrite (edit) of first sumti (I --> Don Quixote), and of tense (unspecified --> past): Don Quixote loved Dulcinea. = I love Dulcinea. Don Quixote loved Dulcinea.

### go'i Within and/or Near Quotations

* These anaphoric words (basyvla) can be used in quotations, but never refer to any of the supporting text outside the quotation, since speakers presumably do not know that they may be quoted by someone else.
However, a "ri"-series or "go'a"-series reference within a quotation can refer to something mentioned in an earlier quotation if the two quotations are closely related in time and context. This allows a quotation to be broken up by narrative material without interfering with the pro-sumti within it (see example below). Of course, there is no problem with narrative material referring to something within a quotation: people who quote, unlike people who are quoted, are aware of what they are doing.
** [la mark. cusku lu mi cliva le zdani li'u .i la .alksyndr. cusku lu mi go'i li'u] = Mark says, "I am leaving the house." Alexander (Alxinder) says, "Me too."
# Lojban/Rafsi

A rafsi (affix) is a (usually) abbreviated version of a gismu (root/basic word) or a cmavo (structure word). They cannot be used alone, but may be compounded in order to create a lujvo –- a more complex word that derives its meaning from the rafsi that compose it (according to Lojbanic grouping-rules). A rafsi may not occur alone; however, a Lojbanic text may have a word that is spelled/said the same way as a rafsi. Such occurrences are in actuality an attitudinal or sumtcita, for example: rafsi: po'o = Japanese...; attitudinal: po'o = the only relevant case.

## Rafsi list

Below is a table of words. The first column is the rafsi; the second column is the gismu from which the rafsi are derived; the third column is the English keywords of the gismu. This table is composed of rafsi and rafsi-meaning since the Great Rafsi Reallocation of 1993. For a full list of both types of rafsi, see: http://www.lojban.org/files/history/bothraf.txt . For a full list of pre-Reallocation rafsi, click the link.
# Lojban/Recordings

* xagji pemci - A poem by Michael Helsem, read by Jorge Llambias (mp3)
* selmo'i - A Chinese Poem translated & read by Aulun (Real Audio)
* jbojufra - Five sentences
** Read by Jorge Llambias - mp3
** Aulun - Real Audio