Monday, October 16, 2006

Jari OS introduction

How I wrote later, I don't like anything from the existing operating system.
There are no innovations on theirs.
So, you can tells to everybody that all is sucks, but do nothing - it's a not a good way to make a better something that sucks for your opinion.
Otherwise, I decide to realize a better look to the operating systems wide in the my research project called "Jari".
Jari is an OS that will contains a new way of kernels, servers set, system libs, core utils and C compiler, maybe if the project will have a success it will be contain a Lisp compiler and most of the libs and users program will be written on it, but it's a long future plans.
Now I'm working with my friend on the kernel and servers.
Kernel has a three rings - the kernel space, the servers space and the user space levels, it's a not a microkernel in the basic opinion, it's a advanced microkernel model.
In the Jari we're have a abstraction atom - is a file, server is a file, cpu is a file etc , but it's not looks like a standart UNIX paradigm, in the Jari we're have an advanced VFS, in example not on all unixes we're have a VFS.
So, just imaginate - on the Jari we're have an exec() on the VFS.
Another thing - we're don't have a big and hard API for intercommunicating with kernel or server, this is a protocol tasks (it's called JP(Jari Protocol)). In example - for running process A on the friend node B you just need to make a frame of the protocol and all. Yes, here we're have a not so light caching and buffering mechanism, but it's a not so hard - in the Jari we're use a development model that mean - "each of the system makes a small task, but many system does a big task" ie each of the kernel part makes a simple task, but all the kernel do any tasks by each of other system.
And in addition, I'm developing now a new filesystem for supporting all the Jari paradigms, but generally we're separate a task ie fs doesn't makes a things on the IPC object or anything other.

To be continued ...

Wednesday, September 27, 2006

Operating Systems: Crisis or reburning ?

Many people told me about good sides of the different OSes, but I'm don't find something new and ready-for-use innovation features in the OSes.
All unixes family has an old philosophy that doesn't support and can't support a good cluster technology. There are a problem of the architecture limits. Developers said -"Hey, we must to do threads it's a good and fast", but nobody from theirs all don't think that threads cannot migrate between nodes in example. Theirs don't thinks about flexibility in generally.
Yes, now I talking about kernels, take a look for the linux kernel, it's a huge trash of the infinite features. They includes a buggy source code for features, *bsd otherwise, they don't include something new, but trying to make a sense of the security and stable features. But we don't have an innovations both in linux or *bsd.
The main reason is the really old architecture.
I'm don't speak about closed OSes such as Solaris or non-unix OS m$ windows - it's a deadly OSes without future.
So, I think that in the time we will see new concept of the kernels and OSes generally, but who ia ready fir this?

Friday, September 22, 2006

bash completion mini-HOW-TO

So, while zsh doesn't supports an unicode, I've tried to add completion functionality to the bash.
I think that this maybe useful for somebody.
There are lines from my ~/.bashrc file:

shopt -s extglob #it's a needable for the bash completion support
set +o nounset

complete -A hostname rsh rcp telnet r ftp ping fail #the standart completion
complete -A export printenv
complete -A variable export local readonly unset
complete -A enabled builtin
complete -A alias alias unalias
complete -A function function
complete -A user su mail finger

complete -A helptopic help # currently same as builtins
complete -A shopt shopt
complete -A stopped -P '%' bg
complete -A job -P '%' fg jobs disown

complete -A directory mkdir rmdir
complete -A directory -o default cd

complete -f -o default -X '*.+(zip|ZIP)' zip #there is completion for the some tools that works with filenames
complete -f -o default -X '!*.+(zip|ZIP)' unzip
complete -f -o default -X '*.+(z|Z)' compress
complete -f -o default -X '!*.+(z|Z)' uncompress
complete -f -o default -X '*.+(gz|GZ)' gzip
complete -f -o default -X '!*.+(gz|GZ)' gunzip
complete -f -o default -X '*.+(bz2|BZ2)' bzip2
complete -f -o default -X '!*.+(bz2|BZ2)' bunzip2

complete -f -o default -X '!*.ps' gs ghostview ps2pdf ps2ascii
complete -f -o default -X '!*.dvi' dvips dvipdf xdvi dviselect dvitype
complete -f -o default -X '!*.pdf' acroread pdf2ps
complete -f -o default -X '!*.+(pdf|ps)' gv
complete -f -o default -X '!*.texi*' makeinfo texi2dvi texi2html texi2pdf
complete -f -o default -X '!*.tex' tex latex slitex
complete -f -o default -X '!*.lyx' lyx
complete -f -o default -X '!*.+(htm*|HTM*)' lynx html2ps

complete -f -o default -X '!*.+(jp*g|gif|xpm|png|bmp)' xv gimp
complete -f -o default -X '!*.+(mp3|MP3)' mpg123 mpg321
complete -f -o default -X '!*.+(ogg|OGG)' ogg123



complete -f -o default -X '!*.pl' perl perl5

_get_longopts ()
{
$1 --help | sed -e '/--/!d' -e 's/.*--\([^[:space:].,]*\).*/--\1/'| grep ^"$2" |sort -u ;
}

_longopts_func () #there are functions for the long function in example for configure
{
case "${2:-*}" in
-*) ;;
*) return ;;
esac

case "$1" in
\~*) eval cmd="$1" ;;
*) cmd="$1" ;;
esac
COMPREPLY=( $(_get_longopts ${1} ${2} ) )
}
complete -o default -F _longopts_func configure bash
complete -o default -F _longopts_func wget id info a2ps ls recode


_make_targets ()
{
local mdef makef gcmd cur prev i

COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}

# if prev argument is -f, return possible filename completions.
# we could be a little smarter here and return matches against
# `makefile Makefile *.mk', whatever exists
case "$prev" in
-*f) COMPREPLY=( $(compgen -f $cur ) ); return 0;;
esac

# if we want an option, return the possible posix options
case "$cur" in
-) COMPREPLY=(-e -f -i -k -n -p -q -r -S -s -t); return 0;;
esac

# make reads `makefile' before `Makefile'
if [ -f makefile ]; then
mdef=makefile
elif [ -f Makefile ]; then
mdef=Makefile
else
mdef=*.mk # local convention
fi

# before we scan for targets, see if a makefile name was specified
# with -f
for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do if [[ ${COMP_WORDS[i]} == -*f ]]; then eval makef=${COMP_WORDS[i+1]} # eval for tilde expansion break fi done [ -z "$makef" ] && makef=$mdef # if we have a partial word to complete, restrict completions to # matches of that word if [ -n "$2" ]; then gcmd='grep "^$2"' ; else gcmd=cat ; fi # if we don't want to use *.mk, we can take out the cat and use # test -f $makef and input redirection COMPREPLY=( $(cat $makef 2>/dev/null | awk 'BEGIN {FS=":"} /^[^.# ][^=]*:/ {print $1}' | tr -s ' ' '\012' | sort -u | eval $gcmd ) )
}

complete -F _make_targets -X '+($*|*.[cho])' make gmake pmake


# cvs(1) completion
_cvs ()
{
local cur prev
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}

if [ $COMP_CWORD -eq 1 ] || [ "${prev:0:1}" = "-" ]; then
COMPREPLY=( $( compgen -W 'add admin checkout commit diff export history import log rdiff release remove rtag status tag update' $cur ))
else
COMPREPLY=( $( compgen -f $cur ))
fi
return 0
}
complete -F _cvs cvs

# svn completion , I'm not sure that this all is right
_svn ()
{
local cur prev
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}

if [ $COMP_CWORD -eq 1 ] || [ "${prev:0:1}" = "-" ]; then
COMPREPLY=( $( compgen -W 'add admin checkout commit diff export history import log rdiff release remove rtag status tag update' $cur ))
else
COMPREPLY=( $( compgen -f $cur ))
fi
return 0
}
complete -F _svn svn


_killall ()
{
local cur prev
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}

# get a list of processes (the first sed evaluation
# takes care of swapped out processes, the second
# takes care of getting the basename of the process)
COMPREPLY=( $( /usr/bin/ps -u $USER -o comm | sed -e '1,1d' -e 's#[]\[]##g' -e 's#^.*/##'| awk '{if ($0 ~ /^'$cur'/) print $0}' ))

return 0
}

complete -F _killall killall killps


# A meta-command completion function for commands like sudo(8), which need to
# first complete on a command, then complete according to that command's own
# completion definition - currently not quite foolproof (e.g. mount and umount
# don't work properly), but still quite useful - By Ian McDonald, modified by me.

_my_command()
{
local cur func cline cspec

COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}

if [ $COMP_CWORD = 1 ]; then
COMPREPLY=( $( compgen -c $cur ) )
elif complete -p ${COMP_WORDS[1]} &>/dev/null; then
cspec=$( complete -p ${COMP_WORDS[1]} )
if [ "${cspec%%-F *}" != "${cspec}" ]; then
# complete -F
# COMP_CWORD and COMP_WORDS() are not read-only,
# so we can set them before handing off to regular
# completion routine
# set current token number to 1 less than now
COMP_CWORD=$(( $COMP_CWORD - 1 ))
# get function name
func=${cspec#*-F }
func=${func%% *}
# get current command line minus initial command
cline="${COMP_LINE#$1 }"
# split current command line tokens into array
COMP_WORDS=( $cline )
$func $cline
elif [ "${cspec#*-[abcdefgjkvu]}" != "" ]; then
# complete -[abcdefgjkvu]
#func=$( echo $cspec | sed -e 's/^.*\(-[abcdefgjkvu]\).*$/\1/' )
func=$( echo $cspec | sed -e 's/^complete//' -e 's/[^ ]*$//' )
COMPREPLY=( $( eval compgen $func $cur ) )
elif [ "${cspec#*-A}" != "$cspec" ]; then
# complete -A
func=${cspec#*-A }
func=${func%% *}
COMPREPLY=( $( compgen -A $func $cur ) )
fi
else
COMPREPLY=( $( compgen -f $cur ) )
fi
}


complete -o default -F _my_command nohup exec eval trace truss strace sotruss gdb
complete -o default -F _my_command command type which man nice