Two-stream instability and oscillatory regimes induced in ballistic diodes and field-effect transistors